1
\$\begingroup\$

I'm trying to replicate the movement in this game: https://www.youtube.com/watch?v=OcvD8BXars8

The players ship along with all other game elements move along the surface of a mesh.

I've tried replicating this by ray-casting down on the mesh to have an idea of the up direction which is fairly straightforward, the problem is rotating the object on the axis of that normal such that the front is always facing the way the player intended (when the player is moving on the mesh the hit normal changes throwing everything off).

\$\endgroup\$
  • \$\begingroup\$ Related: gamedev.stackexchange.com/questions/14328/3d-game-on-a-planet/… \$\endgroup\$ – Ryan Jul 2 '16 at 10:12
  • \$\begingroup\$ You can store the facing direction of the ship and when the hit normal changes because you moved to another polygon, calculate the new direction vector by finding the closest perpendicular vector of the new normal with the previous direction vector \$\endgroup\$ – ibrabeicker Jul 5 '16 at 19:04