- Edited
I have a raycast on an enemy which I want to cast to the player's position. Since the cast_to coordinates are in local space and I need the players global position, I'm trying to find out how to convert the player's global position to the raycast's local space. I just don't know how to do that. I've found out about the to_global() and to_local() functions, but they don't have a clear way to use them to assign a value.
I've tried things like: $RayCast.cast_to = $RayCast.to_local(target) $RayCast.cast_to = target.to_local($RayCast.cast_to) Just as experiments, really, but nothing seems to work.
How do I take the player's position and convert it into the raycast's local space using these functions?