Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. // Transform point B into A's local space.
  2. Vector3 bInAsSpace = a.transform.InverseTransformPoint(b.transform.position);
  3.  
  4. // Find a position along A's x-axis (y = z = 0 in A's local coordinates)
  5. // that matches B's x-coordinate when viewed from A's frame of reference.
  6. Vector3 cInAsSpace = new Vector3(bInAsSpace.x, 0, 0);
  7.  
  8. // Transform this position from A's local space back to world space.
  9. Vector3 cInWordSpace = a.transform.TransformPoint(cInAsSpace);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement