Quantcast
Channel: Questions in topic: "up"
Viewing all articles
Browse latest Browse all 104

LookAt whilst traversing a sphere

$
0
0
Hi, I have a situation where I have an object that is on a sphere. Imagine the red dot is the object, and the green dot is where the object is facing. ![alt text][1] [1]: /storage/temp/158407-diag1.jpg I have code in place to allow the player to click on a point on the sphere and the object will move there. I now want the object to be facing the direction that it is moving. Initially I just went with: object.LookAt(vecNextPointInPath) However, this makes the object tilt in weird ways as it moves. I want to make sure that the top of the object is always facing upwards of the sphere as well as this LookAt. I am able to make it do this, by setting transform.up = transform.position however when I do this in tandem with the LookAt, the LookAt seems to be stomped over and it stays facing the same direction no matter which direction it is moving. Does anyone have a solution to this? I imagine there is something with maths/quaternions that I've not figured out yet. Thanks.

Viewing all articles
Browse latest Browse all 104

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>