Skip to content

Allow clearing PhysX mesh cache or creating convex meshes from numpy arrays #275

@ZoneLikeWonderland

Description

@ZoneLikeWonderland

Is your feature request related to a problem? Please describe.
Yes. PhysxCollisionShapeConvexMesh::LoadMultiple uses MeshManager to cache PhysX meshes by filename and never invalidates them (see src/physx/collision_shape.cpp and src/physx/mesh_manager.cpp).

In a long-running process this causes:

  • Modified meshes with the same filename cannot be reloaded (old cooked mesh is always reused).
  • Memory usage keeps growing as more mesh files are loaded and only drops when the engine/process exits.

Describe the solution you'd like
Either:

  • an API to clear or disable the PhysX mesh cache (C++ and/or Python, e.g. engine.clear_mesh_cache()), or
  • an API to build convex collision shapes directly from numpy vertices / faces arrays, bypassing filename-based caching.

Describe alternatives you've considered

  • Changing the filename each time the mesh changes (works around reload, but makes memory growth even worse).
  • Restarting the whole process/engine to release cached meshes.

Both are impractical for long-running services or RL training.

Additional context
Python call site: sapien.physx.PhysxCollisionShapeConvexMesh.load_multiple(...).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions