[solved] Trouble with rotation

I know, I know… see “scenegraph for dummies”… already done that, please bear with me :stuck_out_tongue:

I’ve made a parent Node, attached a child Geometry to it and attached a CharacterControl to the parent Node.

Then I want to rotate the parent Node. The method getWorldRotation() shows that the parent Node is rotated, but on the screen I don’t see the child rotating…



When the Spatial is linked to a physics object, it cannot be transformed normally. You have to use the physics functions for those operations.

1 Like

Makes sense. Let’s do yet another intermediary node… :stuck_out_tongue:

.setViewDirection should do the Trick :stuck_out_tongue:

1 Like

Well… more or less. With this code I get endless spinning:

Quaternion q;
q.lookAt(norM, Vector3f.UNIT_Y);

How should I fix it?

A quaternion is a rotation, and you probablly apply it in every single frame? resulting in a spinning.

I know, I want to do the CharacterControl equivalent of this:


Don’t you already have an simple lookat point? I mean there has to be a reason for what you want to lookat.

Other than that, simply use x = sin Rotation around y axis (phi) and z = cos phi.

BUt i guess there is something built in like createLookAt.

Take a look at like the chasercams and stuff

1 Like

ah ok

new Vector3f(0,0,1) → forward
→ forward in q rotated space now
setViewDir(forward) → set the rotated forward dir

1 Like