How to determine a node's position with raycasts

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Icyberd

How would I get a node’s 3D position with a Raycast?

I already know how to get the position of the collision, but I can’t find anywhere online that tells me how to find the Node’s global position

:bust_in_silhouette: Reply From: kidscancode

That’s not what Raycast is for.

Since you’re talking about 3D, a Spatial node’s global coordinates are found using global_transform.origin.

:bust_in_silhouette: Reply From: Zylann

The Raycast can give you which node collides with the ray if you call get_collider(). For example, if you collide a StaticBody, it will return that. Then you can get the position of that body with the_body.global_transform.origin.