So is there a way to detect the exact position the raycast stopped casting because something hit it? I dont want the position of what hit it, I want the position of where it got hit.
1 Like
One of the properties of RaycastResult is the position where the ray hit it
local Result = workspace:Raycast(Origin, Direction, raycastParams)
print(Result.Position)
RaycastResult.Position: The world space point at which the intersection occurred, usually a point directly on the surface of the instance.
3 Likes
To add to this, you’ll most likely want to subtract the two vectors (part position - raycast hit position) to get the offset.
1 Like
Position is the point where the ray landed, not the position of whichever part it hit.
The position of the raycast result is in world space, so if you want it’s place relative to the part you can use something like this:
Result.Instance.CFrame:PointToObjectSpace(Result.Position)
2 Likes