Models clip into each other in the 'Synthetic Data' sample

I try to add more models into the ‘Synthetic Data’ sample, and I find out that there are some models that will clip into each other like the red circle in the picture.
‘Synthetic Data’ sample
How can I avoid this?

Could someone help?

@itri459757 In this case, you will have to add logic to spawn assets such that they don’t overlap.

You can use USD APIs to get asset location and min/max range of its corresponding 3D bounding box as shown in the script below. From location and min/max range, you will be to get the 8 corner points of the 3D bounding box corresponding to the asset. The corner points can be used to check for overlaps between assets.

import numpy as np
import omni
from pxr import Usd, UsdGeom, Gf

stage = omni.usd.get_context().get_stage()
result, path = omni.kit.commands.execute("CreateMeshPrimCommand", prim_type="Cone")
# Get the prim
prim = stage.GetPrimAtPath(path)
# Get prim transform and center location
prim_tf = np.array(omni.usd.get_world_transform_matrix(prim))
location = prim_tf[3, :3]
# Get the bounding box range
bbox_cache = UsdGeom.BBoxCache(Usd.TimeCode.Default(), includedPurposes=[UsdGeom.Tokens.default_])
bbox_cache.Clear()
prim_bbox = bbox_cache.ComputeWorldBound(prim)
prim_range = prim_bbox.ComputeAlignedRange()
min_range = prim_range.GetMin()
max_range = prim_range.GetMax()
print("Location: ", location)
print("Min Range: ", min_range)
print("Max Range: ", max_range)

Additional references to bbox cache USD API (the same API applies to both C++ and python): UsdGeomBBoxCache Class Reference

Thanks. I think it’s a good solution.