SHARE
TWEET

Untitled

a guest Jul 21st, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top