Reverse worldrotation

i'm using a simple box (cull always) for collision checks. the problem is that the box rotates when i move the mouse. this leads to quite funny behaviour - the player moves by looking up, down and up again because one of the edges of the box "diggs" through the ground. i need to make the box always face the same direction - how to do that?



(i tried using a geosphere as a bounding model, it worked quite well, but required more cpu time)

A really dumb question… why don't you use a simple Sphere instead of the GeoSphere?

because i use a box.

Yeah, but you said it worked well with GeoSphere, I was just wondering if a plain Sphere would make it faster.

Actually I think a plain sphere would be slower since Geosphere is an optimized type of sphere…



For the first post…

The answer to the question is simple: what is causing the mouse to rotate the the box? If you know what it is, then you can modify the mouse handler so that it doesn't rotate the box but keeps it pointing in the correct direction.

the box is attached to the player, so i have to "de-rotate" the players rotation. or detach the box completely and just move it.

There is a class com.jme.scene.shape.OrientedBox. You could try it and see if it solves your problem.

i'll play around with it.

OrientedBox is just a helper class for rendering the OrientedBoundingBox (OBB) volume.


the box is attached to the player, so i have to "de-rotate" the players rotation. or detach the box completely and just move it.

Put the player and box in a node and have the mouse rotate the player. Apply all other transformations to the node.