Is it possible to check for overlaps without starting simulation?

Hello,

I have already added multiple objects to the scene, and now I want to randomly add new objects using Python code. However, I want to ensure that the newly added objects do not overlap with the existing objects in the scene.

I have checked

  1. the document Frequently Used Python Snippets β€” Omniverse Robotics documentation (nvidia.com)
  2. Some previous discussions Simple Way to check for collision - Omniverse / Isaac Sim - NVIDIA Developer Forums Collision detection by python snippets - Omniverse / Isaac Sim - NVIDIA Developer Forums

I have also attempted to add colliders to all the objects. However, I am unable to obtain overlap information from the get_physx_scene_query_interface().overlap_mesh_any() function. This function always returns False, even when the newly added objects overlap with the old objects.

So, my question is: Is it possible to check the overlaps without press the play button? If it’s possible, what should I do?

Thank you for your assistance.

Hi,
For the get_physx_scene_query_interface().overlap_mesh_any() the objects have to be loaded on PhysX SDK. This means play needs to be pressed.
However you can force load the data into PhysX do your queries and then again release the objects from PhysX.
The code would look like this:

get_physx_interface().force_load_physics_from_usd()

do your queries:
get_physx_scene_query_interface().overlap_mesh_any() 

get_physx_interface().release_physics_objects()

Hope that helps, regards,
Ales

2 Likes

Thank you!