list all ray polygon collisions of geometry

In the documented “pusher” example with frowny colliding into smiley I disabled the push collider and have added a ray collision that tracks the surface of smiley where frowney collides with him. Is there a way to return a list of how many geometry surfaces a ray passes through? This would tell me if frowny is inside smiley or not. If he’s inside there is an odd number of ray surface collisions in one direction away from frowny. If outside there is an even number. I figured there wasn’t already a helper function for detecting if 1 object is inside another so this is how I would make one. Advice greatly appreciated, thanks!

You can simply use the CollisionHandlerQueue instead, or perhaps even use two handers simultaneously.

Or even just “accept” the appropriate collision events – CollisionHandlerPusher is a CollisionHandlerEvent, if I recall correctly.

Right, so I am already using CollisionHandlerQueue and I then loop through all collision entries. So, perhaps if I use the getAll() method, that will spit out all the individual polygon’s of the object it intersected?

Is there a way to automatically generate a CollisionPolygon for all polygons in a 3D model? Eventually when my sphere example is working I want to detect collisions with the entire geometry (not a simplified sphere representation of my model).

Lastly, do you think the “again” event of the CollisionHandlerEvent would be a better approach? For instance, when I first collide I am on the surface of the model. As I continue to move inside the object the “again” event will confirm I am inside? This seems like it would be easier… but does it only detect collision with the surface? E.g. when I am totally inside will it no longer count as a Collision?

ok, got this to work.

My solution to programming an interior test (is a point inside a solid) was to use a ray collider and a CollisionHandlerQueue.

Using the geometry with a bitmask of 0, the ray then collides with all geometry polygons. In doing so, if the number of collisions is odd (using handler.getNumEntries()) then you know the ray origin is inside a given solid.

Another solution is to use getInteriorPoint() of the collision entry. But, this doesn’t appear to work for geometry nodes since only the surface can be detected (at least with my sketchup geometry that is so).

To test for different points, the ray can be translated simply using setPos(x, y, z) as in the documentation.