Collision Detection after spawning prim


I want to check if my prims are spawned in another after creation, so I need something to check if they are colliding. I have only found solutions with Nodes and not with python code (Compute Geometry Penetrations — Omniverse Extensions documentation).

Is there any python function to check if 2 prims are colliding and giving back a boolean value or a count?

I want to generate a new scene if they are colliding.

Thank you!

Nobody got an answer?

Hi @valentinhendrik - In Isaac Sim, you can use the PhysX extension to check for collisions between prims. However, this requires running a physics simulation, which might not be ideal if you just want to check for collisions after spawning prims.

Unfortunately, there isn’t a built-in Python function in Isaac Sim that can directly check for collisions between prims without running a physics simulation.

One possible workaround is to write a custom function that checks for collisions based on the bounding boxes of the prims. Here’s a simple example:

def are_prims_colliding(prim1, prim2):
bbox1 = prim1.GetAttribute(‘primvars:displayColor’)
bbox2 = prim2.GetAttribute(‘primvars:displayColor’)

# Check if the bounding boxes are overlapping in all three dimensions
if (bbox1[0] < bbox2[3] and bbox1[3] > bbox2[0] and
    bbox1[1] < bbox2[4] and bbox1[4] > bbox2[1] and
    bbox1[2] < bbox2[5] and bbox1[5] > bbox2[2]):
    return True
    return False

This function assumes that the displayColor attribute of the prims contains their bounding boxes as six-element lists in the format [xmin, ymin, zmin, xmax, ymax, zmax]. You might need to adjust this depending on how the bounding boxes of your prims are defined.

Please note that this is a very basic collision check and might not be accurate for complex shapes or rotations. For a more accurate collision check, you would need to use a physics engine like PhysX.