Question by
Adam_Pietruszka · Mar 09, 2017 at 05:58 PM ·
transformvectors
Setting some Vector3 as new Vector3.up for a Transform
Hey, I have a planet, which pulls everything towards it with simulated gravity. I want my units to stand up right when standing on the planet. To do this, i calculate this vector3:
Vector3 newUp = (this.transform.position-motherPlanet.position).normalized;//this needs to be the new Vector3.up for this.transform
How do i adjust the rotation of my object to make this happen?
Comment
The simplest way is probably:
transform.up = newUp;
It's worth noting, though, that you've set a single orientation, locking two axes. One axis (the rotation along your new Up) is still free.
Your answer
