I am running Isaac Sim 2022.1. I have this snippet
from omni.isaac.kit import SimulationApp
framerate_limit = 30
app_config = {
"width": 780,
"height": 440,
"window_width": 1320,
"window_height": 760,
"headless": True,
"renderer": "RayTracedLighting",
"display_options": 3220,
}
simulation_app = SimulationApp(app_config)
simulation_app.set_setting("/app/window/drawMouse", True)
simulation_app.set_setting("/app/livestream/proto", "ws")
simulation_app.set_setting("/app/livestream/websocket/framerate_limit", framerate_limit)
simulation_app.set_setting("/ngx/enabled", False)
from omni.isaac.core.utils.extensions import enable_extension
from omni.isaac.core import World
from omni.isaac.core.prims.xform_prim import XFormPrim
from omni.kit.commands import execute
import omni.usd
from omni.isaac.core.utils.stage import get_current_stage
from omni.physx.scripts.utils import setRigidBody
from omni.isaac.core.materials import PhysicsMaterial
from omni.isaac.core.prims import GeometryPrimView
from omni.isaac.core.utils.prims import get_prim_path
from omni.kit.commands import execute
from pxr import Usd, UsdGeom
enable_extension("omni.services.streamclient.websocket")
def apply_friction(parent_prim):
physics_material = PhysicsMaterial("/Looks/friction_material", static_friction=10, dynamic_friction=10)
for prim in Usd.PrimRange(parent_prim):
prim_path = get_prim_path(prim)
if prim.IsA(UsdGeom.Mesh) and not prim_path.endswith("/visuals"):
view = GeometryPrimView(prim_path)
view.apply_physics_materials(physics_material)
def add_pink_box(position):
prim_path = "/small_KLT_visual_collision"
execute(
"CreateReferenceCommand",
usd_context=omni.usd.get_context(),
path_to=prim_path,
asset_path="http://omniverse-content-production.s3-us-west-2.amazonaws.com/Assets/Isaac/2022.1/Isaac/Props/KLT_Bin/small_KLT_visual_collision.usd",
instanceable=False,
)
prim = get_current_stage().GetPrimAtPath(prim_path)
apply_friction(prim) # Try to comment and uncomment this line
return prim
world = World(stage_units_in_meters=0.01)
ground_plane = world.scene.add_default_ground_plane()
XFormPrim(ground_plane.prim_path).set_local_scale([100] * 3)
add_pink_box([10, 10, 10])
world.reset()
while simulation_app._app.is_running() and not simulation_app.is_exiting():
simulation_app.update()
if world.is_playing() and world.current_time_step_index == 0:
world.reset()
simulation_app.close()
If I run it, the pink KLT box (asset for Isaac Sim) is broken and the label which should be on a side is crossing the middle of the box.
However, commenting out the apply_friction function fixes it and the box is also a lot smaller (as it should be since the world uses centimeters and the asset is not rescaled). To see the box, zoom in a lot and continue zooming it, it will appear.
Can someone please explain this behavior?`