Rotations

Sorry to be cluttering up the forum with so many questions, but I’m having some problems with the rotations.

I have a box geometry, I want to rotate it 30 degrees around the y axis. I tried:

[java]geom2.rotate(0f,(float)Math.toRadians(30.0) ,0);[/java]

It does seem to be rotating the box correctly, but the box is catapulted across the screen. Am I doing something wrong?

I thought this would keep the boxes center point the same, just rotate the spatial around the y axis.

Thanks

Your box mesh is probably not centered at the origin.

Use the box constructor with half extents to ensure it is:
[java]Box b = new Box (float xHalfExtent, float yHalfExtent, float zHalfExtent);[/java]

My box isn’t centered at the origin, I pass it a vector3f centerpoint during construction. I need it to be in that position though. Should I be centering it on the origin then updating the local translation instead?

@sabredog said: My box isn't centered at the origin, I pass it a vector3f centerpoint during construction. I need it to be in that position though. Should I be centering it on the origin then updating the local translation instead?

Precisely.

Worked a treat! Thanks guys