Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - frit

Pages: [1]
Support / Orientation on spherical surface
« on: July 24, 2012, 07:03:01 pm »
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!

Pages: [1]