I'm looking for a solution for moving a variety of objects over the uneven surface of my planet. The idea is that I will have a number of objects that follow the planetary landscape moving about in random directions.
The planet surface is made up of 6 sphere projected planes, all have been displacement mapped to create a "bumpy" surface. A grid based movement system would be ideal as it lends itself to a lot of pathfinding solutions. I am also using Unity, so leveraging the Physics engine is an option, but past experience hasn't yielded very good results.
I'm having trouble understanding the best approach for realistic movement, would it be a matter of calculating gravity and then translating the object along its forward, right etc. Or on the other hand would It be more a case of pre-calculating the path from A to B and applying that movement.
I've looked all over for some ideas on this subject but have found nothing. A few suggestions would be greatly appreciated.
Thanks.
Answer
Having used Unity before, I would try my best to leverage the physics engine as best as I could. Basically what I would do is represent the positions in polar coordinates + a rotation for facing direction. So essentially the polar coordinates would give you a unique position on a perfect sphere(which you could map to a grid keeping in mind that the grid wraps around and pinches off at certain places) and the extra rotation would specify the angle around the vector perpendicular to the sphere at that location. Unity and the physics engine will take care of the actual motion as long as you provide a constant gravitation "pull" from the centroid of the object towards the centroid of the planetoid. To create motion around the planetoid you simply need to provide a force perpendicular to the normal vector of the planet surface at that position rotated to the direction of travel around the sphere.
No comments:
Post a Comment