Hello!
I am fairly new to 3d engines (obviously, to jPCT too!) and I'm starting to create an Android application using it.
What I am trying to achieve is a spherical world upon which models (like characters, trees, buildings) stand and move.
So far, I've managed to position them on the world surface (which took me a hard time hehe).
Now I want to know what is the best way to orientate them accordingly to their position (in relation to the sphere center) so they are always aligned to the normal of the surface regardless of where they stand/move.
I've found there is a method called "setOrientation" which requires 2 vectors as parameters, but I guess I didn't understand how it works. I've tried to fill the direction vector with the x,y,z coordinates of the object in the space (touching the surface) and the up vector with the same coordinates calculation, but considering a sphere of radius+1 (so the generated axis becomes normal to the sphere). Unfortunately, this didn't work... maybe someone can clear up for me how this method really works? Or maybe suggesting a better way for me to do what I need?
(sorry if this got confusing!)
Thank you for your time!
I am fairly new to 3d engines (obviously, to jPCT too!) and I'm starting to create an Android application using it.
What I am trying to achieve is a spherical world upon which models (like characters, trees, buildings) stand and move.
So far, I've managed to position them on the world surface (which took me a hard time hehe).
Now I want to know what is the best way to orientate them accordingly to their position (in relation to the sphere center) so they are always aligned to the normal of the surface regardless of where they stand/move.
I've found there is a method called "setOrientation" which requires 2 vectors as parameters, but I guess I didn't understand how it works. I've tried to fill the direction vector with the x,y,z coordinates of the object in the space (touching the surface) and the up vector with the same coordinates calculation, but considering a sphere of radius+1 (so the generated axis becomes normal to the sphere). Unfortunately, this didn't work... maybe someone can clear up for me how this method really works? Or maybe suggesting a better way for me to do what I need?
(sorry if this got confusing!)
Thank you for your time!