Moving A Ray Relative To Parent, Not World

How can I make it so the ray starts a certain distance away from the front of an object. So when the object rotates, the ray start point stays in the same relative position to the object.

var ray = new Ray(transform.localPosition + Vector3.forward * 10, transform.TransformDirection(Vector3.forward));

That was my attempt. But it only moves it based on a global axis.

Thanks for you time,
Magnus :slight_smile:

You can use the transform.forward.

var ray = new Ray(transform.position + transform.forward * distanceAway, transform.forward);

Note I don’t understand your use of ‘localPosition’ in the above code.