Advertisement
Guest User

Untitled

a guest
Dec 31st, 2018
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. Quaternion relativeOrientation = Quaternion.identity * Quaternion.Euler((-VC.targetHeading + 90) * new Vector3(1, 0, 0));
  2. relativeOrientation = relativeOrientation * Quaternion.Euler((VC.targetPitch) * new Vector3(0, 0, 1));
  3. relativeOrientation = relativeOrientation * Quaternion.Euler((VC.targetRoll + 90) * new Vector3(0, 1, 0));
  4.  
  5. Vector3d CoM, north, east;
  6. CoM = AV.CoM;
  7. Vector3 up = (CoM - AV.mainBody.position).normalized;
  8. north = Vector3d.Exclude(up, (AV.mainBody.position + AV.mainBody.transform.up * (float)AV.mainBody.Radius) - CoM).normalized;
  9.  
  10. east = Vector3d.Cross(up, north);
  11.  
  12. Quaternion goalOrientation = Quaternion.LookRotation(north, east) * relativeOrientation;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement