BufferAttribute not applying matrix for some reason

Hello , i’ve been facing a problem on my project , i used Matrix4.applyToBufferAttribute , in one of my functions it was’t applying the matrix for some reason:

let updatedRef = meshes[0].matrix.applyToBufferAttribute(
   meshes[0].geometry.attributes.position
);
//Stupid Fix (Bug ?)
if (updatedRef === meshes[0].geometry.attributes.position) {

    updatedRef = meshes[0].matrix.applyToBufferAttribute( 
        meshes[0].geometry.attributes.position
     );
}

I had to repeat the applyMatrix again to make it works , but doesn’t seems right !!!

TBH, I don’t understand how you fix should solve this problem. The if statement does never evaluate to false since Matrix4.applyToBufferAttribute() always returns the given attribute.

Please demonstrate the issue with a live example.

BTW: When updating a buffer attribute, you have to set BufferAttribute.needsUpdate to true. Otherwise the respective WebGL buffer does not reflect the current data.

1 Like

Yea the fix was doing nothing , i was debugging :confused:
Now the Matrix4.applyToBufferAttribute() return a bufferatrribute ? or apply the matrix directly ?