a guest Jul 21st, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- // Transform point B into A's local space.
- Vector3 bInAsSpace = a.transform.InverseTransformPoint(b.transform.position);
- // Find a position along A's x-axis (y = z = 0 in A's local coordinates)
- // that matches B's x-coordinate when viewed from A's frame of reference.
- Vector3 cInAsSpace = new Vector3(bInAsSpace.x, 0, 0);
- // Transform this position from A's local space back to world space.
- Vector3 cInWordSpace = a.transform.TransformPoint(cInAsSpace);
RAW Paste Data