I’m currenlty using KeyNodeRotateLeftAction and KeyNodeRotateRightAction classes in conjunction with InputHandler to rotate an object around. Right now the object seems to rotate at its base.
Currently it rotates around O as shown below
|
|
|
|
|
|
O ----
I want it to rotate around the center like this
|
|
|----O----|
|
|
Is there an easy way to change the axis of rotation? I want to try and use built in stuff before I start messing with matrixes myself (cause I really hate it heh)
The first problem is to define center. The only way that comes to mind is just change the Vertex information in the TriMesh so that 0,0,0 is the "center" that you want (IE move them all up or down some) and just rotate like normal.
I would love it to be anywhere. I.e. defining a pivot point. So It would be nice if I say defined the pivot point at around -100, -100, -100 and it would rotate around that point… I guess its a similar thing to what your doing.
Yeah … You could probably use the getcenter method, get the difference between (0,0,0) and then translate the whole model within it’s local coordinate space to that position. But it would be nice if there was a setAxisOfRotation method or something hehe For now since I’m just doing tech demos I’ll change the coords by hand since theres only 5 vertices to do. (its a tri mesh)
You can put an additional node in-between the mesh and the node you are rotating. Setting the Local translation on the new node would change the point of rotation.