Rotating a CharacterControl

[java]

Vector3f mView = Mplayer.getViewDirection();

Mplayer.setViewDirection(new Vector3f(mView.x, mView.y, mView.z+10*FastMath.DEG_TO_RAD));[/java]



I am using the above code to try and rotate the CharacterControl, as normen advised in another post. However, the spatial attached to it (and the collision shape itself) doesn’t rotate. I am trying this because the spatial doesn’t rotate when I use spatial.rotate().



Any help? Thanks

I am sure I didn’t advise to do that.

You said: “You have to set the viewDirection for the CharacterControl which rotates the spatial directly attached to it or use a node for the CharacterControl and attach the spatial to that to rotate it without using the viewDirection.”



I might have understood wrong :wink: Anyways, how can I rotate the spatial?

Rotate the direction vector, don’t just set random coords on it: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:math_for_dummies

A direction vector is a unity vector that marks a relative direction from its 0/0/0 base.

1 Like

And here I was, trying to rotate using angles -.- Thanks a lot!



Btw, I rated you up to 1111 :stuck_out_tongue: