Im trying to rotate a BoxMesh around its Axis.
Without Physijs.Scene.simulation()
rotateOnAxis works, but with the simulation it doesn't work. With the simulation it does move around its position.
this.player.__dirtyPosition = true;
// move forwards/backwards/left/right
if ( this.keyboard.pressed("W") )
this.player.translateZ( -moveDistance );
if ( this.keyboard.pressed("S") )
this.player.translateZ( moveDistance );
if ( this.keyboard.pressed("Q") )
this.player.translateX( -moveDistance );
if ( this.keyboard.pressed("E") )
this.player.translateX( moveDistance );
// rotate left/right/up/down
if ( this.keyboard.pressed("A") )
{
this.player.rotateOnAxis( new THREE.Vector3(0,1,0), rotateAngle);
}
if ( this.keyboard.pressed("D") )
{
this.player.rotateOnAxis( new THREE.Vector3(0,1,0), -rotateAngle);
}
So W,S,Q,E works but A,D doesn't work with Physijs.Scene.simulation()
, A,D does work without Physijs.Scene.simulation()
. Any ideas?
**Edit solved:
It is obvious that this.player.__dirtyPosition = true;
only allows you to change the position, but not the rotation, i looked inside the code and searched for something similar so i found that there is also a this.player.__dirtyRotation = true;
which solved my problems! =)