Rotated RayCast3D: Adding point at end of target_position not accounting for rotation, pls help!

Hey, I have a raycast3D that when on a “attack” command creates a sphere at the end of its target position.

My problem is I don’t know(and have a hard time finding out…) how to account for the rotation of the raycast, so when I left click, the sphere is created as if the raycast is at its default 0,0,0 rotation. That is, when the raycast is pointing downwards.

Here is my code:

Help is appreciated!

You have to multiply the node’s transform by the target vector.

shape_global_position = test_ray.global_transform * test_ray.target_position

1 Like

Thank you! This works, and here is my changed code: