PhysicsScene#
Fully qualified name: isaacsim::core::simulation_manager::PhysicsScene
-
class PhysicsScene#
High level wrapper for manipulating a USD Physics Scene prim and its attributes.
This class provides a convenient interface for working with USD Physics Scene prims. It wraps the underlying pxr::UsdPhysicsScene and provides methods for accessing physics-related properties such as gravity.
The class can be constructed from a string path, SdfPath, or UsdPrim. If the prim at the specified path does not exist, a new PhysicsScene prim will be created. If the prim exists but is not a PhysicsScene, an exception will be thrown.
Note
The class uses the default USD context’s stage for all operations.
Public Functions
-
PhysicsScene(const std::string &path)#
Constructs a PhysicsScene from a string path.
If a prim exists at the specified path, it must be a PhysicsScene prim. If no prim exists at the path, a new PhysicsScene prim will be created.
- Parameters:
path – [in] The USD path to the physics scene prim.
- Throws:
std::invalid_argument – If a prim exists at the path but is not a PhysicsScene.
-
inline PhysicsScene(const pxr::SdfPath &path)#
Constructs a PhysicsScene from an SdfPath.
Converts the SdfPath to a string and delegates to the string constructor.
- Parameters:
path – [in] The SdfPath to the physics scene prim.
- Throws:
std::invalid_argument – If a prim exists at the path but is not a PhysicsScene.
-
inline PhysicsScene(const pxr::UsdPrim &prim)#
Constructs a PhysicsScene from a UsdPrim.
Extracts the path from the UsdPrim and delegates to the string constructor.
- Parameters:
prim – [in] The UsdPrim representing the physics scene.
- Throws:
std::invalid_argument – If the prim is not a PhysicsScene.
-
inline const std::string &getPath()#
Gets the USD path to the physics scene prim.
- Returns:
Const reference to the path string.
-
inline const pxr::UsdPrim &getPrim()#
Gets the underlying UsdPrim.
- Returns:
Const reference to the UsdPrim.
-
inline const pxr::UsdPhysicsScene &getPhysicsScene()#
Gets the underlying UsdPhysicsScene schema.
- Returns:
Const reference to the UsdPhysicsScene.
-
pxr::GfVec3d getGravity()#
Gets the gravity vector for the physics scene.
Computes the gravity vector by multiplying the gravity direction by the gravity magnitude and adjusting for the stage’s meters-per-unit scale.
- Returns:
The gravity vector in world units per second squared.
-
bool isValid() const#
Checks if the physics scene prim is still valid.
Returns true if the underlying USD prim is valid and active. This can return false if the prim was deleted, the layer containing it was removed, or the stage was closed.
- Returns:
True if the prim is valid and active, false otherwise.
-
PhysicsScene(const std::string &path)#