user2788945
user2788945

Reputation: 273

Scaling an object in three.js

I am getting Matrix3.getInverse(): can't invert matrix, determinant is 0 three.js 3976 error when I am trying to scale a cube object.

var object = new.THREE.Mesh(geometry, material)
 xScale = 0.1;
 object.scale.x = object.scale.y = object.scale.z = xScale;

Could someone help me out of this.

Upvotes: 20

Views: 22569

Answers (2)

mrdoob
mrdoob

Reputation: 19602

Matrix3.getInverse(): can't invert matrix, determinant is 0 usually happens when either the scale.x, scale.y or scale.z are 0. Make sure you're not scaling the object to 0.

Upvotes: 17

Darryl_Lehmann
Darryl_Lehmann

Reputation: 2198

I think you may be trying to use a Matrix3 where a Matrix4 is required. At least in r61 of the three.js library, the line you refer to is pulling from the matrix array beyond index 8 (ie. a 16 element matrix vs. a 9 element). If you need any advice beyond that provide some code and description to what your trying to achieve with the inverse matrix, good luck!

Upvotes: 0

Related Questions