The zillionth rotation question … sorry ^^

Ok, i know i can yaw and pitch, i may rotate around one axis when i provide an left- and an up-vector, but what i dont get inside my head and wasnt able to find in the forum or in the math for dummies is the following:

I want to rotate a Billboard clockwise depending on my tpf. So it still should have its local z-axis pointing right into my screen whereever that might be.

Shouldnt…
[java]
mySpatial.getLocalRotation().fromAngleAxis(someFactor, Vector3f.UNIT_Z);
[/java]
…rotate that thing around the axis pointing to the Screen (for a billboard, thats the z-axis, isnt it?)
When i comment the Bildboard control out, it rotates as expected – is just no billboard anymore…^^ I tried screenmode, cameramode… doesnt work.
How do i let that beast rotate around it’s z-axis? As the z-axis is the only axis a default billboard should be able to rotate around … how do i do it?

The maths of this are not clear to me either. What I understand is that axes do rotate with the object. Thus the local Z axis do points to your camera.
But your rotation do rotate it around World Z axis. An that’s not as good for what you want.

My advice would be to add an intermediate Node with the Billboard control. This node is rotated toward the screen. Then you rotate your spatial which is in the node along ITS Z axis.

@rhavin said: Ok, i know i can yaw and pitch, i may rotate around one axis when i provide an left- and an up-vector, but what i dont get inside my head and wasnt able to find in the forum or in the math for dummies is the following:

I want to rotate a Billboard clockwise depending on my tpf. So it still should have its local z-axis pointing right into my screen whereever that might be.

Shouldnt…
[java]
mySpatial.getLocalRotation().fromAngleAxis(someFactor, Vector3f.UNIT_Z);
[/java]
…rotate that thing around the axis pointing to the Screen (for a billboard, thats the z-axis, isnt it?)
When i comment the Bildboard control out, it rotates as expected – is just no billboard anymore…^^ I tried screenmode, cameramode… doesnt work.
How do i let that beast rotate around it’s z-axis? As the z-axis is the only axis a default billboard should be able to rotate around … how do i do it?

Never ever modify the results of the getLocalRotation(), getLocalTranslation(), etc. directly. If you do then bad things will happen.

Try:
[java]mySpatial.setLocalRotation( new Quaternion().fromAngleAxis(someFactor, Vector3f.UNIT_Z) );[/java];

Or if you prefer:
[java]mySpatial.setLocalRotation( new Quaternion().fromAngles( 0, 0, someFactor ) );[/java]

Both of those assume “someFactor” is not a delta but an ever-changing value. If you have some delta, then you can also do:

[java]mySpatial.rotate( 0, 0, delta * tpf );[/java]

…which is supposed to rotate around the Z-axis relative to whatever the current rotation is.

Where you are going to get into trouble is where you are doing this. If you don’t do it after the billboard control updates then it will end up resetting whatever you do. You have two choices: make sure you update after BillboardControl (and then use the rotate() method) or have a Node and a child Spatial and put the billboard on the Node and rotate the child.