Currently im implementing a 3D compass into my game but am stuck as of how to script it…
This is the basic look that im going for:
So my first thought was too build a sphere and apply a compass texture to it, then based on where the camera is looking on the 360 degree axis is where the sphere is rotated to?
If anyone has any better suggestions, or could point me in a direction of how to go about coding this that would be greatly appreciated…
You’re definitely on the right track, especially if you want it to move in all three dimensions. If it’s just horizontal movement, that’s another (similar) way to do it. But for these floating ball compasses, you’d probably want 3 dimensional rotation.
Take a look at the LookAt functions and the SmoothFollow camera script for pointers on how to do it. Also, if ‘north’ is not actually on an axis in your environment, stick some object way the heck off in the distance, get the location of that, and have the compass ‘look’ at that location.
For very, very minor performance reasons, there’s no really good reason to use an actual object for the ‘North Pole’, you just need its position.