#how to get node from raycast

8 messages · Page 1 of 1 (latest)

midnight torrent
#

I am using intersect_ray to get a node but I am wondering how to do commands like get_meta or set_meta with it from the result or run a command in the node

#

for instance I click something and it goes node.explodeanddie()

arctic magnet
#

i have the feeling that i'm missing something. once you have the node you should be able to call anything you want on it.

fast kernel
#

i could only assume what OP means is that the raycast likely gives a reference to the collisionbody it interacted with and OP wants a way to get from there to an arbitrary parent node that actually houses the script one would want to interact with?

midnight torrent
#

Yeah I'm using the physics raycast in script and I want to interact with the node that it hits in script

#

It gives a collision id in a dictionary but I am unsure how to use that to edit the collision-er

vernal ocean
#

If the script you are trying to reference is on the highest level in your packedscene instance, couldn't you use get_owner()?

midnight torrent
#

this is what I have thus far for the ray, I am wondering how to use this function to interact with whatever the ray hits, e.g. que_freeing it or running a function in it