Add child to raycast3d collider

I’ve been creating a hitscan gun and i’m trying to add bullet hole decals. I’ve been able to get it to work for static objects, but the position and rotation of the decal on rigid bodies doesn’t follow the object. I thought the easiest way to do this is to just add the decal as a child but i can’t get the actual node of the raycast collider.

What does your script look like so far? get_collider() should get you the colliding body.

Yes it gives me the collider as an object but i can’t add a child to it

Why not? How is your rigid body set up?

if raycast.get_collider() is RigidBody3D:
    raycast.get_collider().add_child(new_decal)

Ok i’m not sure why it wasn’t working but i rewrote it slightly and now directly adding the child works. It must’ve been a different issue. Thanks for your help

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.