Skip to content Skip to sidebar Skip to footer

Rotate Object Around World Axis With Tween.js

I want to rotate a cube on world axis by using tween.I am able to rotate the cube around world axis without using tween by using rotateAroundWorldAxis(cube[1], new THREE.Vector3(0,

Solution 1:

You can use tween to change a generic value from 0 to 90 and then in the update use the rotateAroundWorldAxis function

var cubeAngle = 0; // use this global variable if you want to rotate more than one time

in tween initialization

var start = {angle: cubeAngle};
var end = {angle: cubeAngle + 90};

in onUpdate

cubeAngle=this.angle;    
rotateAroundWorldAxis(cube[1], new THREE.Vector3(0,1,0),degreeToRadians(cubeAngle));

Post a Comment for "Rotate Object Around World Axis With Tween.js"