jPCT-AE - a 3d engine for Android > Support

Rotation issue in JPCT-AE

<< < (2/2)

mr.jack:
Some debugging, and still the is something not quite clear.
Tried rotate around a face (the middle of it, like 0,10,0), works nice. If I set already a X or Y, it goes where it shouldn't go, the feeling that the pivot doesn't work with the world coordinates, or it translates the object to some unknown coordinates.. (making it 0,0,10, also changes the X for pivot for some reason). Took into consideration the fact that the axes are rotated as explained http://www.jpct.net/wiki/index.php/Coordinate_system
Out of ideas.

EgonOlsen:
The pivot is given in object space...i'm not sure if you are aware of this after reading your post. Anyway, that might not matter in this case anyway. Setting a pivot doesn't cause a translation, at least not directly. It might of course look like one in the end, because the object will certainly move when rotating because of the pivot which isn't located in its center any longer, but that's not a real translation.
I haven't looked at the code but maybe your problem arises from the initial rotation to make the box axis aligned. If you are doing this by a simple rotation, the results of further rotations might be confusing, because they might not be what one expects (because the axes don't rotate with the object).
Try to make your initial 45° rotation permanent to the mesh by adding


--- Code: ---...
box.rotateMesh();
box.clearRotation();

--- End code ---

mr.jack:
"These are the Droids I was looking for"  :D
Thank you! This is it, I should rotate the mesh.
Yep, I know that a rotation around a point is a combination of translation+rotation, just I didn't know about the mesh..

Navigation

[0] Message Index

[*] Previous page

Go to full version