Problems with transformation

Hi,



I have an object that is rotated around the z axis a little. What transformation do I need to apply if I want to rotate the whole object around the vertical axis. If I write

[java]obj_phy.setPhysicsRotation(this.getLocalRotation().mult(new Quaternion().fromAngleAxis(-0.01f, new Vector3f(0, 1, 0))));[/java]

it always rotates around the y-axis of the object, which of course isn’t vertical anymore.

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:math_for_dummies

I’ll give you a hint.



Vectors represent 3 axis. X, Y and Z.

Also, 0 sometimes means “nothing” or “off” and 1 “on”…

I know, I solved the first problem: I had to multiply the vector with the quaternion and not the quaternion with the vector.

If I write getPhysicsRotation().getColoum(1), does this give me the y rotation of the object?

If that method is like the quaternion one then column 1 represents the Y axis, or your “facing”. But that depends on a lot of things. In a typical setup that would true.

Allright, it doesn’ work :slight_smile:

How would I get just the rotation around the y-axis of a RigidBodyControl object?

quaternion.toAxes()/toAngles()?

Yes, it works, thanks.