How to do simple collision detection of two objects without complex simulation?

How to do simple collision detection of two objects without complex simulation? Let’s say I have object A and object B, and they both have colliders, and now I just want to detect whether object A and object B are colliding without simulating them.

You should be able to use the scene query interface, please check the scene query demos.
Objects have to be parsed into PhysX, so you need to call something like:

from omni.physx import get_physx_scene_query_interface, get_physx_simulation_interface

# load stuff into PhysX (if you dont want to press play)
cache = UsdUtils.StageCache.Get()
stage_id = cache.GetId(stage).ToLongInt()
get_physx_simulation_interface().attach_stage(stage_id)

# see the overlap demo python script for the usage
path_tuple = PhysicsSchemaTools.encodeSdfPath(Sdf.Path(self._mesh_path))
_ = get_physx_scene_query_interface().overlap_shape(path_tuple[0], path_tuple[1], self.report_hit, False)

get_physx_simulation_interface().detach_stage()

Regards,
Ales

I don’t quite understand what you mean. The effect I want is similar to the collision matrix in unity. Can I set it using UI interface?

No, I am afraid there is no UI interface for this. Sorry.

I don’t understand your code, can you give me more details? Let’s say I have object A and object B, and I just need to check if they collide. I don’t need to have a collision in the simulation.

There are no standalone scene queries without simulation out of the box to be used. There are a couple of options you can use:
a) The code above does load data into PhysX, then you can perform scene queries like overlap to ask if things do overlap or not.
b) If you are interested in overlapping only you can also you clash detection for that. Please see this repository: GitHub - NVIDIA-Omniverse/clash-detection-samples: clash-detection-samples

But there is no standalone function that you can call to ask if object A does collide with Object B. Either you load things into PhysX, you dont have to simulate but the objects have to be created inside PhysX in order to perform the queries.
Or you can try to see if the clash detection which is a triangle mesh based collision detection works for your usecase.

Regards,
Ales