0

I've a tube geometry built with 2000 points stored as JSON data. The tube has band (curves) also. I am using TrackBallControls.

Now when I rotate the tube, it is rotated in all three dimensions. The rotation is not limited to any particular axis.

I am using following code after creating tubeMesh.

// to make rotation only on x-axis
var v = new THREE.Vector3(1,0,0).normalize();           
var matrix = new THREE.Matrix4();
tubeMesh.applyMatrix(matrix.makeRotationAxis(v, 0));            
tubeMesh.applyMatrix(matrix.makeTranslation(0,-1500,0));

if ( tube.debug ) tubeMesh.add( tube.debug );
scene.add(tubeMesh);

This code does not work as the tube is rotating on all three dimensions. Even I've tried the functions defined in below question.

three.js rotation

How do fix the rotation axis so that the tube will be rotated only on specified axis ?

using r53

Community
  • 1
  • 1
Valay
  • 1,991
  • 2
  • 43
  • 98
  • Trackball controls rotates the camera, not the object. I would suggest that you abandon trackball controls, and refer to the three.js examples for how to use the mouse to rotate an object on a single axis. – WestLangley Dec 22 '12 at 19:03
  • I am using trackball controls for panning and zooming facility as I've to render this model on iPad. Which example should I refer ?-@WestLangley – Valay Dec 22 '12 at 19:24

0 Answers0