How do I get the location at the end of a raycast?

Ok, so here is what I’m trying to do.

I have a gameobject that can change position, rotation, and scale. On that gameobject I have a script attached that has a different gameobject linked/inserted into it.

I’m trying to make a script that when the “Main” gameobject rotates/scales/moves the “Linked” gameobject in the script follows this rotation/movement and if the scale increases the distances between the objects increases so that there is always a set distance between them (like 10% of the size of the “linked” gameobject")

One way I though of is to fire a raycast out from the main object so that the rotation and movement will be known, and the distance can easily be calculated. I’m not certain this is the best way but I don’t know how to get the position at the end of the raycast.

Can anyone help me?

Thank you

haha, nevermind. I figured out how to do that. Not 5 minutes after the question I found my answer.

Vector3 up = transform.TransformDirection(Vector3.up);

using Something like this I can get the distance of 1 in that direction. With that I can multiply it by a certain amount to get an exact distance.

I can view where it is using Debug.DrawRay(transform.position, up,;

sorry if I wasted anyone’s time.

Maybe just create an empty Gameobject at the point where you would normally have the end point of your ray and reference that instead? I’m not entirely sure I understand what you’re trying to do.