Skip to content

Unable to perform animation on a circleGeometry #1246

Answered by saurabhiam
saurabhiam asked this question in Q&A
Discussion options

You must be logged in to vote

I figured it out.

I had to create a new Vector3() and had to pull vector coordinated using fromBufferAttribute() and then set the normalised values using positionAttribute.setXYZ(i, vertex.x, vertex.y, vertex.z);

const update = () => {
    const positionAttribute = bubble.current.geometry.attributes.position;
    const vertex = new Vector3();
    for (let i = 0; i < positionAttribute.count; i++) {
      const b = vertex.fromBufferAttribute(positionAttribute, i);
      vertex.normalize().multiplyScalar(3 + 0.5 * simplex.noise4D( b.x * spikes, b.y * spikes, b.z * spikes + time, 5));
      positionAttribute.setXYZ(i, vertex.x, vertex.y, vertex.z);
    }
    positionAttribute.needsUpdate = true;

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by saurabhiam
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant