0

I am creating a web page to illustrate the 3D transformations and I am using Three.js. I have detected a problem when I try to do a negative scale in Y axis. In this case, the object is not affected (a face inversion should be done but it doesn't). However, for negative scales in axis X or Z it works well. Any help? This is my code:

var m = new THREE.Matrix4(
    scaleX, 0,      0,      0,
    0,      scaleY, 0,      0,
    0,      0,      scaleZ, 0,
    0,      0,      0,      1 
);
cube.applyMatrix(m);

If I use cube.scale.set(scaleX,scaleY,scaleZ) the first transformation is performed rightly, but I can't link with other transformations. I need for my application that the user can do several transformations in the same scene.

Thanks in advance

Wilt
  • 41,477
  • 12
  • 152
  • 203
María
  • 1
  • Duplicate of http://stackoverflow.com/questions/16824650/three-js-how-to-flip-normals-after-negative-scale/ and http://stackoverflow.com/questions/16469270/transforming-vertex-normals-in-three-js/ – WestLangley Oct 10 '13 at 14:06

1 Answers1

-1

Your matrix is not correct. Try with :

var m = new THREE.Matrix4(
    1, 0, 0, scaleX,
    0, 1, 0, scaleY,
    0, 0, 1, scaleZ,
    0, 0, 0, 1
);

cube.applyMatrix(m);
Wilt
  • 41,477
  • 12
  • 152
  • 203
Troopers
  • 5,127
  • 1
  • 37
  • 64
  • That is for repositioning an object, not for scaling it. After applying this matrix your values are the new x, y and z coordinates of the position of the object. – Wilt Sep 08 '14 at 16:13