53 [[nodiscard]]
virtual char const*
GetName()
const = 0;
63 virtual void Step(
double timeStepSec) = 0;
219 std::string_view layerA,
220 std::string_view layerB,
225 std::string_view layerA,
226 std::string_view layerB,
236 std::function<
void(std::string_view name)>
const& callback)
const = 0;
257 std::string_view debugName,
258 std::function<
void(
StepInfo const&)> callback,
262 std::string_view debugName,
263 std::function<
void(
StepInfo const&)> callback,
Represents a simulated body (actor) in a scene.
Represents a constraint that restricts the degrees of freedom of one or more actors.
Main entry point for SuperDex Physics simulation.
Manages debug visualization features for a scene.
A dynamically resizable array with syntax and behavior similar to std::pmr::vector.
Represents a simulation scene.
virtual void ReleaseState(StateHandle handle)=0
Release a StateHandle when you are done with it.
virtual int GetNumContactLayers() const =0
Get the number of unique contact layer names in the scene.
virtual void EnumerateContactLayerNames(std::function< void(std::string_view name)> const &callback) const =0
Enumerate all unique contact layer names in the scene.
virtual Context const * GetContext() const =0
Get read-only access to the Context that owns this scene.
virtual Actor const * GetActor(ActorHandle actor) const =0
Get a const pointer to the Actor associated with an ActorHandle.
virtual Constraint * CreateRigidSphericalJointConstraint(RigidSphericalJointConstraintParams const ¶ms, Error &error)=0
Create a spherical joint constraint between two rigid actors.
virtual double GetLastTimeStep() const =0
Returns the time step size [s] from the most recent positive call to Step.
virtual char const * GetName() const =0
Get the name of the scene.
virtual Constraint * CreateRodElementRotationToRigidConstraint(RodElementRotationToRigidConstraintParams const ¶ms, Error &error)=0
Create a rotation constraint between a rigid actor and a rod element.
virtual Context * GetContext()=0
Get the Context that owns this scene.
virtual Constraint * CreateRigidPrismaticJointConstraint(RigidPrismaticJointConstraintParams const ¶ms, Error &error)=0
Create a prismatic joint constraint between two rigid actors.
virtual Constraint * CreateRigidPivotToRigidTargetConstraint(RigidPivotToRigidTargetConstraintParams const ¶ms, Error &error)=0
Create a position constraint between a rigid actor's pivot point and the world position of that pivot...
virtual void ForEachConstraint(std::function< void(Constraint const *)> const &callback) const =0
Iterate over all the constraints in the scene using a callback (const version).
virtual void ReleaseAllStates()=0
Release memory for all captured state and invalidate all prior StateHandle objects.
virtual void RestoreState(StateHandle handle, bool releaseImmediately, Error &error)=0
Restore captured simulation state.
virtual Constraint * CreateArticulated3dRotationRangeConstraint(Articulated3dRotationRangeConstraintParams const ¶ms, Error &error)=0
Create a range constraint on the DoFs of a 3D rotation joint of an articulated actor.
virtual CallbackHandle RegisterPostStepCallback(std::string_view debugName, std::function< void(StepInfo const &)> callback, int priority=kDefaultCallbackPriority)=0
Register a callback to execute after each simulation step.
virtual void DestroyConstraint(ConstraintHandle constraint)=0
Destroy a constraint and remove it from the scene.
virtual StateHandle CaptureState(Error &error)=0
Capture the simulation state that changes from step to step for later restoration.
virtual bool GetForceSingleIsland() const =0
Get whether all actors are forced to be in a single simulation island.
virtual CallbackHandle RegisterPreStepCallback(std::string_view debugName, std::function< void(StepInfo const &)> callback, int priority=kDefaultCallbackPriority)=0
Register a callback to execute before each simulation step.
virtual void ForEachActor(std::function< void(Actor const *)> const &callback) const =0
Iterate over all the actors in the scene using a callback (const version).
virtual DebugDraw & GetDebugDraw()=0
Get the debug draw interface for this scene.
virtual ~Scene()=default
Don't delete the Scene pointer. Call Context::DestroyScene.
virtual SolverStats GetSolverStats() const =0
Get solver convergence metrics from the last simulation step.
virtual void EnableLayerContactAsymmetric(std::string_view layerA, std::string_view layerB, bool enable, Error &error)=0
Enable or disable collision detection for an ordered pair of contact layer names.
virtual PerformanceStats GetPerformanceStats() const =0
Get timing and profiling metrics from the last simulation step.
virtual bool IsRecording() const =0
Check if the scene is currently recording.
virtual bool IsEqualState(StateHandle stateA, StateHandle stateB) const =0
Return true if both StateHandles are valid and refer to identical state information (full precision).
virtual SceneHandle GetHandle() const =0
Get the scene handle.
virtual void ForEachConstraint(std::function< void(Constraint *)> const &callback)=0
Iterate over all the constraints in the scene using a callback.
virtual void RestoreStateFromBytes(Span< uint8_t const > data, Error &error)=0
Restore simulation state from a binary byte buffer produced by CaptureStateToBytes.
virtual int GetNumConstraints() const =0
Get the number of constraints in the scene.
virtual Actor * CreateSoftSkinnedActor(SoftSkinnedActorParams const ¶ms, Error &error)=0
Create a soft-skinned actor with an articulated skeleton.
virtual double GetTotalSimulationTime() const =0
Returns the total simulation time [s] in the scene.
virtual void SetSolverParams(SolverParams const ¶ms, Error &error)=0
Set the solver parameters.
virtual void EnableActorContactAsymmetric(ActorHandle colliding, ActorHandle collider, bool enable, IncludeNestedActors includeNestedActors, Error &error)=0
Enable or disable collision detection between two actors.
virtual Real3 GetGravity() const =0
Get the gravity vector in world frame.
virtual void GetActors(Span< Actor * > outActors, Error &error)=0
Get Actor pointers for all the actors in the scene.
virtual void GetActors(Span< Actor const * > outActors, Error &error) const =0
Get const Actor pointers for all the actors in the scene.
virtual Constraint * CreateJointRotationRangeConstraint(JointRotationRangeConstraintParams const ¶ms, Error &error)=0
Create a range constraint on joint rotation.
virtual void DestroyConstraint(Constraint *constraint)=0
Destroy a constraint and remove it from the scene.
virtual void SetGravity(Real3 const &gravity)=0
Set the gravity vector in world frame.
virtual void UpdateDebugger()=0
This gives the debugger a chance to process messages that require reading or writing scene state.
virtual void CaptureStateToBytes(DynamicArray< uint8_t > &outData, Error &error)=0
Capture simulation state to a binary byte buffer.
virtual void ForEachActor(std::function< void(Actor *)> const &callback)=0
Iterate over all the actors in the scene using a callback.
virtual void EnableActorContactSymmetric(ActorHandle actorA, ActorHandle actorB, bool enable, IncludeNestedActors includeNestedActors, Error &error)=0
Equivalent to calling EnableActorContactAsymmetric with actorA and actorB in both orders using the sa...
virtual Constraint * CreateArticulated3dRotationTargetConstraint(Articulated3dRotationTargetConstraintParams const ¶ms, Error &error)=0
Create a target constraint on an articulated 3D rotation.
virtual void CancelCallback(CallbackHandle handle)=0
Cancel a previously registered callback.
virtual Constraint * CreateJointRotationTrackingConstraint(JointRotationTrackingConstraintParams const ¶ms, Error &error)=0
Create a tracking constraint on joint rotation.
virtual void Step(double timeStepSec)=0
Advance the simulation of the Scene one step.
virtual Constraint * CreateDeformableNodeToRigidConstraint(DeformableNodeToRigidConstraintParams const ¶ms, Error &error)=0
Create a constraint connecting a deformable node to a rigid actor.
virtual Actor * CreateRigidActor(RigidActorParams const ¶ms, Error &error)=0
Create a rigid body actor.
virtual Actor * GetActor(ActorHandle actor)=0
Get the Actor pointer associated with an ActorHandle.
virtual void StartRecording(std::string_view filePath, RecordingParams const ¶ms, Error &error)=0
Create or replace the specified file and start recording the scene to an HDF5 file.
virtual bool IsLayerContactEnabled(std::string_view layerA, std::string_view layerB) const =0
Check if collision detection is enabled for an ordered pair of contact layer names.
static constexpr int kDefaultCallbackPriority
Default priority for callback ordering.
virtual Constraint * CreateArticulatedSingleDofTargetConstraint(ArticulatedSingleDofTargetConstraintParams const ¶ms, Error &error)=0
Create a target constraint on a single articulated DoF.
virtual Constraint * CreateRigidPivotPositionConstraint(RigidPivotPositionConstraintParams const ¶ms, Error &error)=0
Create a position constraint on a rigid actor's pivot point.
virtual Constraint * CreateDeformableNodeToDeformableNodeConstraint(DeformableNodeToDeformableNodeConstraintParams const ¶ms, Error &error)=0
Create a constraint connecting two deformable actor nodes.
virtual Constraint * CreateArticulatedSingleDofRangeConstraint(ArticulatedSingleDofRangeConstraintParams const ¶ms, Error &error)=0
Create a range constraint on a single articulated DoF.
virtual Constraint * CreateRigidPivotRotationConstraint(RigidPivotRotationConstraintParams const ¶ms, Error &error)=0
Create a rotation constraint on a rigid actor's pivot frame.
virtual int GetNumActors() const =0
Get the number of actors in the scene, including nested link actors and nested soft actors.
virtual Constraint * CreateDeformableNodePositionConstraint(DeformableNodePositionConstraintParams const ¶ms, Error &error)=0
Create a position constraint on a deformable actor node.
virtual Actor * CreateSoftActor(SoftActorParams const ¶ms, Error &error)=0
Create a soft deformable actor.
virtual void CaptureStateToFile(std::string_view filePath, Error &error)=0
Captures a snapshot of the state of a Scene, similar to Scene::CaptureState, then writes the data to ...
virtual Constraint * GetConstraint(ConstraintHandle constraint)=0
Get the Constraint pointer associated with a ConstraintHandle.
virtual SolverParams GetSolverParams() const =0
Get the solver parameters.
virtual Actor * CreateArticulatedActor(ArticulatedActorParams const ¶ms, Error &error)=0
Create an articulated actor.
virtual void EnableLayerContactSymmetric(std::string_view layerA, std::string_view layerB, bool enable, Error &error)=0
Equivalent to calling EnableLayerContactAsymmetric with layerA and layerB in both orders.
virtual DebugDraw const & GetDebugDraw() const =0
Get a const reference to the debug draw interface for this scene.
virtual void DestroyActor(ActorHandle actor)=0
Destroy an actor and remove it from the scene.
virtual Constraint const * GetConstraint(ConstraintHandle constraint) const =0
Get the const Constraint pointer associated with a ConstraintHandle.
virtual void StopRecording()=0
Stop recording the scene and close the recording file.
virtual void SetForceSingleIsland(bool forceSingleIsland)=0
Enables/disables forcing all actors in the scene to be in a single simulation island.
IncludeNestedActors
Specifies whether actor-contact filtering also applies to nested actors.
constexpr Real3 kDefaultGravity
Default gravity acceleration in world frame [m/s²].
Unique identifier for an Actor within a Scene.
Parameters for creating a range constraint on a 3D-rotation articulated joint.
Parameters for creating a target constraint on 3D rotation DoFs of an articulated actor.
Parameters to create an articulated actor.
Parameters for creating a range constraint on a single articulated DoF.
Parameters for creating a target constraint on a single articulated DoF.
Unique identifier for a callback registration within a Scene.
Unique identifier for a Constraint within a Scene.
Parameters for creating a joint rotation range constraint between two rigid actors.
Parameters for creating a joint rotation tracking constraint between two rigid actors.
Parameters controlling what data gets included in a scene recording.
Parameters to create a rigid body actor.
Parameters for creating a position constraint on a rigid actor's pivot point.
Parameters for creating a rotation constraint on a rigid actor's pivot frame.
Parameters for creating a constraint on a rigid actor's pivot point.
Parameters for creating a prismatic joint between two rigid actors.
Parameters for creating a spherical joint between two rigid actors.
Parameters for creating a tracking constraint on the relative rotation between a rigid actor and a ro...
Unique identifier for a Scene within a Context.
Parameters to create a soft deformable actor.
Parameters to create soft-skinned actors with a shared articulated skeleton.
Simulation solver configuration parameters.
Solver convergence metrics from the last simulation step.
Unique identifier for a captured simulation state within a Scene.
Information passed to per-step callbacks.