0

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?

sourcecode

**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! =)

4

1 回答 1

0

很明显 this.player.__dirtyPosition = true; 只允许你改变位置,但不能改变旋转,我查看了代码并搜索了类似的东西,所以我发现还有一个 this.player.__dirtyRotation = true; 这解决了我的问题!=)

于 2015-05-25T13:58:37.293 回答