Skip to content

[Question] number of physics material exceed 64K #2286

@xindonglin99

Description

@xindonglin99

What's the correct way to spawn the same assets with different prim path?

I'm trying to spawn 20 cubes in each environment as stepping stones. This is the code that I'm using

def create_step_cfg(num_steps: int, size: Tuple[float, float, float]) -> RigidObjectCollectionCfg:
    """Create a step configuration."""
    collection = {}
    spawn_cfg = sim_utils.CuboidCfg(
        size=size,
        rigid_props=sim_utils.RigidBodyPropertiesCfg(kinematic_enabled=True),
        collision_props=sim_utils.CollisionPropertiesCfg(collision_enabled=True),
        visual_material=sim_utils.PreviewSurfaceCfg(diffuse_color=(0.1, 0.1, 0.1), metallic=0.2),
        physics_material=sim_utils.RigidBodyMaterialCfg(
        friction_combine_mode="average",
        restitution_combine_mode="average",
        static_friction=1.0,
        dynamic_friction=1.0,
        restitution=0.0,
        ),
    )
    initial_state = RigidObjectCfg.InitialStateCfg()

    for i in range(num_steps):
        key = "step_" + str(i)
        current_prim_path = "/World/envs/env_.*/" + key 
        collection[key] = RigidObjectCfg(
            prim_path=current_prim_path,
            spawn=spawn_cfg,
            init_state=initial_state,
            collision_group=0,
            debug_vis=False,
    )

        
    return RigidObjectCollectionCfg(rigid_objects=collection)

in _setup_scene(self), I just do

self.steps = RigidObjectCollection(self.cfg.steps)

However, it seems for each stepping stone, one new physics material is created. And there's an error saying the number of physics materials exceeds the limit 64K. I would like to ask what is the correct way of creating one physics material and reusing it for every rigid object in the rigid object collection.

Also, I wonder if I'm using RigidObjectCollection in the correct way as every rigid object in it is technically the same but just with different prim paths. Any suggestions on this are appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions