Retrieving replicator value

@ahaidu while prepering a simple test case I realized the Issue.

First, the setup of the test case:

I’ve set up an empty stage with two spheres with colliders and added a PhysicsScene:

this is the code I paste in the Script Editor:

import omni.isaac.core.utils.bounds as bounds_utils
import carb
from pxr import Gf
import omni.timeline
timeline = omni.timeline.get_timeline_interface()
from omni.physx import get_physx_scene_query_interface

def report_hit(hit):
    carb.log_warn(f"Object {hit} is overlapping with objects")

def is_overlapping(prim_path):

    stage = omni.usd.get_context().get_stage()
    # get extent of the object from the bounding box
    cache = bounds_utils.create_bbox_cache(time=timeline.get_current_time())

    bounds = bounds_utils.compute_combined_aabb(cache, prim_paths=[prim_path])
    usd_bounds = Gf.Range3d((bounds[0], bounds[1], bounds[2]),  # min
                    (bounds[3], bounds[4], bounds[5])) # max
    carb.log_warn(f"Object bounds : {usd_bounds}")
    _extent = usd_bounds.GetSize()   
    extent = carb.Float3(_extent[0], _extent[1], _extent[2])

    carb.log_warn(f"Object extent : {extent}")

    mesh_prim = stage.GetPrimAtPath(prim_path)

    global_position = mesh_prim.GetAttribute("xformOp:translate").Get()

    carb.log_warn(f"Object position : {global_position}")
    origin = carb.Float3(global_position[0], global_position[1], global_position[2])

    rotation = carb.Float4(0,0, 0, 1)

    numHits = get_physx_scene_query_interface().overlap_box(extent, origin, rotation, report_hit, False)

    if numHits > 0:
        carb.log_warn(f"Object is overlapping with {numHits} objects")
        return True

    carb.log_warn(f"Object is NOT overlapping")
    return False

prim_path = "/World/Sphere1"


The only thing that needs to be modifies here is the path to the sphere prim (second to last line in the code snippet).

The issue is that numHits is always at least 1. why? because the function detects colliders in a defined area enclosing the sphere (defined by extent, position, and rotation) and the sphere itself has a collider.
so it is detecting a collision with itself.

I guess the easiest way to handle this is to define a collision when numHits > 1.

Is there a way to visualize the area that is defined by extent, position, and rotation? Looking at my test case. when the two spheres are pretty far apart, numHits is still 2.

so i’m thinking I need to debug extent and probably rotation as well.

But just from putting a simple test case together I already have a good understading of whats going on! Thank you again for all of your high quality help.