I’m making a plugin for the editor to ease object positioning and that involves raycasting. The problem is: I want to exclude CSG children of a node from raycasting, but I don’t see a way to get their RID to pass as exclude in intersect_ray, and they immediately get in the way, blocking the real intersections I want to capture.
These CSG children have “use collision” flag enabled. I do see some RID once I get the raycast result, but I need that RID beforehand (otherwise I will have to continuously run queries while adding each new RID of each CSG by one at a time).
How do I get RID of CSG to not query them?
P. S. I can see in the sources that root_collision_shape is not exposed, so it seems there’s no way to get RID at the moment?..
P. P. S. It’s also not possible to get RID by object instance id (the one attached in the source code) either…
No, this is not the solution, because I do need to raycast against other, non-selected CSG-s in the scene, I need to exclude only the currently selected ones (transitively, i.e. CSG-s of currently selected nodes as well)
Yeah, this is what I’m asking about. I can easily do this for children Area3D / PhysicsBody3D as they all have RID. But not CSG shapes, so they can be used neither with PhysicsDirectSpaceState2D.intersect_ray() nor with RayCast3D.add_exception().
All resources have an RID. If there is a collisionobject node that uses a CSG for its collision shape it will be registered with the physics server under the rigidbody, staticbody, or area.
Checkout the link, I originally posted. As you can see in the sources, CSG shape does create a body and a shape internally - even stores the RID and attaches object instance id to the body - but I cannot find a way to get it.
That’s what the question is: how do I get a RID of CSGShape’s collision object? Or, alternatively, how do I exclude particular CSGShape from physics queries like intersect_raycast?
To me it looks like it is impossible, but I wanted to ask a question first before I file an issue on GitHub