custom axis

lets say at the world-coord. 4,0,4 is the origin
and i create a axis-vector, for example 0.5, 0.0, 0.5 from the origin-point

now i want to know the distance from a object, to the origin on this axis-vector

how do i do that?


Don’t worry, let Unity do the hard work for you. You can create an empty object (let’s call it Origin), place it at your coordinate system origin and rotate it to the orientation you want. When you need to know the local coordinates in this system, use Transform.InverseTransformPoint:

var origin: Transform; // drag your Origin object here

// convert a worldPoint to the local space:
var localCoord: Vector3 = origin.InverseTransformPoint(worldPoint);