duck

Set orientation to align with sphere surface

Nov 10th, 2011
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. private void SetOrientation()
  2. {
  3. Vector3 surfaceUp = transform.position - planet.transform.position;
  4. surfaceUpRotation.SetLookRotation(surfaceUp, -transform.forward);
  5. surfaceUpRotation *= Quaternion.Euler(90,0,0);
  6. transform.rotation = surfaceUpRotation;
  7. }
  8.  
Advertisement
Add Comment
Please, Sign In to add comment