BepuPhysics
Handles the movement of constraints from higher indexed batches into lower indexed batches to avoid accumulating a bunch of unnecessary ConstraintBatches.
Gets or sets the desired number of candidates to analyze as a fraction of the total number of constraints.
Gets or sets the maximum number of constraint moves that can occur in a single execution of Compress as a fraction of the total number of constraints.
Index of the constraint batch to optimize.
Incrementally finds and applies a set of compressions to apply to the constraints in the solver's batches.
Constraints in higher index batches try to move to lower index batches whenever possible.
Index of the set owning the body reference. If the island index is 0, the body is active.
Index of the body within its owning set. If the body is active (and so the Island index is -1), this is an index into the Bodies data arrays.
If it is nonnegative, it is an index into the inactive island
Collection of all allocated bodies.
Remaps a body handle integer value to the actual array index of the body.
The backing array index may change in response to cache optimization.
The set of existing bodies. The slot at index 0 contains all active bodies. Later slots, if allocated, contain the bodies associated with inactive islands.
Note that this buffer does not necessarily contain contiguous elements. When a set is removed, a gap remains.
Gets a reference to the active set, stored in the index 0 of the Sets buffer.
Reference to the active body set.
The world transformed inertias of active bodies as of the last update. Note that this is not automatically updated for direct orientation changes or for body memory moves.
It is only updated once during the frame. It should be treated as ephemeral information.
Gets or sets the minimum constraint capacity for each body. Future resizes or allocations will obey this minimum, but changing this does not immediately resize existing lists.
Constructs a new bodies collection. Initialize must be called for the instance to be ready for use.
Pool for the collection to pull persistent allocations from.
Shapes referenced by the collection's bodies.
Broad phase containing the body collidables.
Initial number of bodies to allocate space for in the active set.
Initial number of islands to allocate space for in the Sets buffer.
Expected number of constraint references per body to allocate space for.
Initializes the bodies set. Used to complete bidirectional dependencies.
Solver responsible for the constraints connected to the collection's bodies.
Island awakener to use when bodies undergo transitions requiring that they exist in the active set.
Updates the bounds held within the broad phase for the body's current state. Does not expand the bounding box by velocity. If there is no shape associated with the body, this does nothing.
Adds a new active body to the simulation.
Description of the body to add.
Handle of the created body.
Removes an active body by its index. Any constraints connected to this body will be removed. Assumes that the input location is valid.
Index of the active body.
Removes a body from the set by its handle. If the body is inactive, all bodies in its island will be forced active.
Handle of the body to remove.
Adds a constraint to an active body's constraint list.
Index of the body to add the constraint to.
Handle of the constraint to add.
Index of the body in the constraint.
Removes a constraint from an active body's constraint list.
Index of the active body.
Handle of the constraint to remove.
Gets whether the inertia matches that of a kinematic body (that is, all inverse mass and inertia components are zero).
Body inertia to analyze.
True if all components of inverse mass and inertia are zero, false otherwise.
Gets whether the angular inertia matches that of a kinematic body (that is, all inverse inertia tensor components are zero).
Body inertia to analyze.
True if all components of inverse mass and inertia are zero, false otherwise.
Changes the local mass and inertia tensor associated with a body. Properly handles the transition between kinematic and dynamic.
If the body is becoming kinematic, any constraints which only contain kinematic bodies will be removed.
Wakes up the body.
Handle of the body whose inertia should change.
New local inertia for the body.
This function is only necessary when the inertia change could potentially result in a transition between dynamic and kinematic states.
If it is guaranteed to be dynamic before and after the change, the inertia can be directly modified without issue.
Changes the shape of a body. Properly handles the transition between shapeless and shapeful. If the body is inactive, it will be forced awake.
Updates the bounds of the body in the broad phase.
Handle of the body to change the shape of.
Index of the new shape to use for the body.
Applies a description to a body. Properly handles any transitions between dynamic and kinematic and between shapeless and shapeful.
If the body is becoming kinematic, any constraints which only contain kinematic bodies will be removed. Wakes up the body.
Updates the bounds of the body in the broad phase.
Handle of the body to receive the description.
Description to apply to the body.
Gets the description of a body by handle.
Handle of the body to look up.
Description of the body.
Gets a reference to a body by its handle.
Handle of the body to grab a reference of.
Reference to the desired body.
Checks whether a body handle is currently registered with the bodies set.
Handle to check for.
True if the handle exists in the collection, false otherwise.
Gathers inertia for one body bundle into an AOSOA bundle.
Active body indices being gathered.
Number of bodies in the bundle.
Gathered inertia of body A.
Gathered inertia of body B.
Gathers inertia for two body bundles into AOSOA bundles.
Active body indices being gathered.
Number of bodies in the bundle.
Gathered inertia of body A.
Gathered inertia of body B.
Gathers inertia for three body bundles into AOSOA bundles.
Active body indices being gathered.
Number of bodies in the bundle.
Gathered inertia of body A.
Gathered inertia of body B.
Gathered inertia of body C.
Gathers inertia for four body bundles into AOSOA bundles.
Active body indices being gathered.
Number of bodies in the bundle.
Gathered inertia of body A.
Gathered inertia of body B.
Gathered inertia of body C.
Gathered inertia of body D.
Gathers orientations for two body bundles into AOSOA bundles.
Active body indices being gathered.
Number of body pairs in the bundle.
Gathered orientation of body A.
Gathered orientation of body B.
Gathers orientations for one body bundles into AOSOA bundles.
Active body indices being gathered.
Number of body pairs in the bundle.
Gathered orientation of bodies in the bundle.
Gathers pose information for a body bundle into an AOSOA bundle.
Active body indices being gathered.
Number of body pairs in the bundle.
Gathered absolute position of the body.
Gathered orientation of the body.
Gathers orientations and relative positions for a two body bundle into an AOSOA bundle.
Active body indices being gathered.
Number of body pairs in the bundle.
Gathered offsets from body A to body B.
Gathered orientation of body A.
Gathered orientation of body B.
Gathers relative positions for a two body bundle into an AOSOA bundle.
Active body indices being gathered.
Number of body pairs in the bundle.
Gathered offset from body A to of body B.
Gathers relative positions for a three body bundle into an AOSOA bundle.
Active body indices being gathered.
Number of body pairs in the bundle.
Gathered offset from body A to of body B.
Gathered offset from body A to of body C.
Gathers relative positions for a four body bundle into an AOSOA bundle.
Active body indices being gathered.
Number of body pairs in the bundle.
Gathered offset from body A to of body B.
Gathered offset from body A to of body C.
Gathered offset from body A to of body D.
Gathers velocities for one body bundle and stores it into a velocity bundle.
Active set indices of the bodies to gather velocity data for.
Number of bodies in the bundle.
Gathered velocities.
Gathers velocities for two body bundles and stores it into velocity bundles.
Active set indices of the bodies to gather velocity data for.
Number of body pairs in the bundle.
Gathered velocities of A bodies.
Gathered velocities of B bodies.
Gathers velocities for three body bundles and stores it into velocity bundles.
Active set indices of the bodies to gather velocity data for.
Number of body pairs in the bundle.
Gathered velocities of A bodies.
Gathered velocities of B bodies.
Gathered velocities of C bodies.
Gathers velocities for four body bundles and stores it into velocity bundles.
Active set indices of the bodies to gather velocity data for.
Number of body pairs in the bundle.
Gathered velocities of A bodies.
Gathered velocities of B bodies.
Gathered velocities of C bodies.
Gathered velocities of D bodies.
Scatters velocities for one body bundle into the active body set.
Velocities of body bundle A to scatter.
Active set indices of the bodies to scatter velocity data to.
Number of body pairs in the bundle.
Scatters velocities for two body bundles into the active body set.
Velocities of body bundle A to scatter.
Velocities of body bundle B to scatter.
Active set indices of the bodies to scatter velocity data to.
Number of body pairs in the bundle.
Scatters velocities for three body bundles into the active body set.
Velocities of body bundle A to scatter.
Velocities of body bundle B to scatter.
Velocities of body bundle A to scatter.
Active set indices of the bodies to scatter velocity data to.
Number of body pairs in the bundle.
Scatters velocities for four body bundles into the active body set.
Velocities of body bundle A to scatter.
Velocities of body bundle B to scatter.
Velocities of body bundle A to scatter.
Velocities of body bundle B to scatter.
Active set indices of the bodies to scatter velocity data to.
Number of body pairs in the bundle.
Enumerates all the bodies connected to a given active body.
Bodies which are connected by more than one constraint will be reported multiple times.
Type of the enumerator to execute on each connected body.
Index of the active body to enumerate the connections of. This body will not appear in the set of enumerated bodies, even if it is connected to itself somehow.
Enumerator instance to run on each connected body.
Solver from which to pull constraint body references.
Enumerates all the bodies connected to a given body.
Bodies which are connected by more than one constraint will be reported multiple times.
Type of the enumerator to execute on each connected body.
Handle of the body to enumerate the connections of. This body will not appear in the set of enumerated bodies, even if it is connected to itself somehow.
Enumerator instance to run on each connected body.
Solver from which to pull constraint body references.
Clears all bodies from all sets without releasing any memory that wouldn't be released by a sequence of regular removals.
Reallocates the inertias buffer for the target capacity. Will not shrink below the size of the current active set.
Guarantees that the inertias capacity is sufficient for the given capacity.
Resizes the allocated spans for active body data. Note that this is conservative; it will never orphan existing objects.
Target body data capacity.
Resizes all active body constraint lists to meet the MinimumConstraintCapacityPerBody. Inactive bodies are untouched.
Resizes are guaranteed to never shrink a list below the current count.
Increases the size of active body buffers if needed to hold the target capacity.
Target data capacity.
Ensures all active body constraint lists can hold at least MinimumConstraintCapacityPerBody constraints. Inactive bodies are untouched.
Returns all body resources to the pool used to create them.
The object can be reused if it is reinitialized by using EnsureCapacity or Resize.
Threshold of squared velocity under which the body is allowed to go to sleep. This is compared against dot(linearVelocity, linearVelocity) + dot(angularVelocity, angularVelocity).
The number of time steps that the body must be under the sleep threshold before the body becomes a sleep candidate.
Note that the body is not guaranteed to go to sleep immediately after meeting this minimum.
Creates a body activity description.
Threshold of squared velocity under which the body is allowed to go to sleep. This is compared against dot(linearVelocity, linearVelocity) + dot(angularVelocity, angularVelocity).
The number of time steps that the body must be under the sleep threshold before the body becomes a sleep candidate.
Note that the body is not guaranteed to go to sleep immediately after meeting this minimum.
Computes a decent default speculative margin for a shape based on its minimum and maximum radii.
Type of the shape to compute a speculative margin for.
Shape to compute a speculative margin for.
Speculative margin for the given shape.
Computes a decent default activity description for a shape.
Type of the shape to create an activity description for.
Shape to create an activity description for.
Default activity description for the given shape.
Creates a dynamic body description.
Pose of the body.
Initial velocity of the body.
Local inertia of the body.
Collidable to associate with the body.
Activity settings for the body.
Constructed description for the body.
Creates a dynamic body description with zero initial velocity.
Pose of the body.
Local inertia of the body.
Collidable to associate with the body.
Activity settings for the body.
Constructed description for the body.
Creates a dynamic body description with identity orientation.
Position of the body.
Initial velocity of the body.
Local inertia of the body.
Collidable to associate with the body.
Activity settings for the body.
Constructed description for the body.
Creates a dynamic body description with zero initial velocity and identity orientation.
Position of the body.
Local inertia of the body.
Collidable to associate with the body.
Activity settings for the body.
Constructed description for the body.
Creates a dynamic body description with collidable, inertia, and activity descriptions generated from a convex shape. Adds the shape to the given shape set.
Type of the shape to create a body for.
Pose of the body.
Initial velocity of the body.
Mass of the body. The inertia tensor will be calculated based on this mass and the shape.
Shape collection to add the shape to.
Shape to add to the shape set and to create the body from.
Constructed description for the body.
Creates a dynamic body description with identity orientation and collidable, inertia, and activity descriptions generated from a convex shape. Adds the shape to the given shape set.
Type of the shape to create a body for.
Position of the body.
Initial velocity of the body.
Mass of the body. The inertia tensor will be calculated based on this mass and the shape.
Shape collection to add the shape to.
Shape to add to the shape set and to create the body from.
Constructed description for the body.
Creates a dynamic body description with zero initial velocity and collidable, inertia, and activity descriptions generated from a convex shape. Adds the shape to the given shape set.
Type of the shape to create a body for.
Pose of the body.
Mass of the body. The inertia tensor will be calculated based on this mass and the shape.
Shape collection to add the shape to.
Shape to add to the shape set and to create the body from.
Constructed description for the body.
Creates a dynamic body description with zero initial velocity, identity orientation, and collidable, inertia, and activity descriptions generated from a convex shape. Adds the shape to the given shape set.
Type of the shape to create a body for.
Position of the body.
Mass of the body. The inertia tensor will be calculated based on this mass and the shape.
Shape collection to add the shape to.
Shape to add to the shape set and to create the body from.
Constructed description for the body.
Creates a kinematic body description.
Pose of the body.
Initial velocity of the body.
Collidable to associate with the body.
Activity settings for the body.
Constructed description for the body.
Creates a kinematic body description with zero initial velocity.
Pose of the body.
Collidable to associate with the body.
Activity settings for the body.
Constructed description for the body.
Creates a kinematic body description with identity orientation.
Position of the body.
Initial velocity of the body.
Collidable to associate with the body.
Activity settings for the body.
Constructed description for the body.
Creates a kinematic body description with identity orientation and zero initial velocity.
Position of the body.
Collidable to associate with the body.
Activity settings for the body.
Constructed description for the body.
Creates a kinematic body description with collidable and activity descriptions generated from a convex shape. Adds the shape to the given shape set.
Type of the shape to create a body for.
Pose of the body.
Initial velocity of the body.
Shape collection to add the shape to.
Shape to add to the shape set and to create the body from.
Constructed description for the body.
Creates a kinematic body description with identity orientation and collidable and activity descriptions generated from a convex shape. Adds the shape to the given shape set.
Type of the shape to create a body for.
Position of the body.
Initial velocity of the body.
Shape collection to add the shape to.
Shape to add to the shape set and to create the body from.
Constructed description for the body.
Creates a kinematic body description with zero initial velocity and collidable and activity descriptions generated from a convex shape. Adds the shape to the given shape set.
Type of the shape to create a body for.
Pose of the body.
Shape collection to add the shape to.
Shape to add to the shape set and to create the body from.
Constructed description for the body.
Creates a kinematic body description with zero initial velocity, identity orientation, and collidable and activity descriptions generated from a convex shape. Adds the shape to the given shape set.
Type of the shape to create a body for.
Position of the body.
Shape collection to add the shape to.
Shape to add to the shape set and to create the body from.
Constructed description for the body.
Incrementally changes the layout of a set of bodies to minimize the cache misses associated with the solver and other systems that rely on connection following.
Gets or sets the fraction of all bodies to update each frame.
Represents a rigid transformation.
Transforms a vector by the rigid pose: v * pose.Orientation + pose.Position.
Vector to transform.
Pose to transform the vector with.
Transformed vector.
Transforms a vector by the inverse of a rigid pose: (v - pose.Position) * pose.Orientation^-1.
Vector to transform.
Pose to invert and transform the vector with.
Transformed vector.
Inverts the rigid transformation of the pose.
Pose to invert.
Inverse of the pose.
Concatenates one rigid transform with another. The resulting transform is equivalent to performing transform a followed by transform b.
First transform to concatenate.
Second transform to concatenate.
Result of the concatenation.
Threshold of squared velocity under which the body is allowed to go to sleep. This is compared against dot(linearVelocity, linearVelocity) + dot(angularVelocity, angularVelocity).
Setting this to a negative value guarantees the body cannot go to sleep without user action.
The number of time steps that the body must be under the sleep threshold before the body becomes a sleeping candidate.
Note that the body is not guaranteed to go to sleep immediately after meeting this minimum.
If the body is awake, this is the number of time steps that the body has had a velocity below the sleep threshold.
True if this body is a candidate for being slept. If all the bodies that it is connected to by constraints are also candidates, this body may go to sleep.
Convenience structure for directly referring to a body's properties.
Note that this type makes no attempt to protect against unsafe modification of body properties, nor does modifying its properties try to wake up bodies if they are asleep.
Handle of the body that this reference refers to.
The bodies collection containing the body.
Constructs a new body reference.
Handle of the body to refer to.
Collection containing the body.
Gets whether the body reference exists within the body set. True if the handle maps to a valid memory location that agrees that the handle points to it, false otherwise.
Gets a reference to the body's memory location stored in the handle to location mapping.
Gets or sets whether the body is in the active set. Setting this to true will attempt to wake the body; setting it to false will force the body and any constraint-connected bodies asleep.
Gets a reference to the body's velocity.
Gets a reference to the body's pose.
Gets a reference to the body's collidable.
Gets a reference to the body's local inertia.
Gets a reference to the body's activity state.
Gets a reference to the list of the body's connected constraints.
Gets whether the body is kinematic, meaning its inverse inertia and mass are all zero.
Gets whether the body has locked inertia, meaning its inverse inertia tensor is zero.
If the body is dynamic, turns the body kinematic by setting all inverse inertia and mass values to zero and activates it.
Any constraints connected to the body that now only contain kinematic references are removed.
If the body is kinematic, does nothing.
Sets the body's local inertia to the provided inertia. Wakes up the body and correctly handles any transition between dynamic and kinematic states.
If the body moves from dynamic to kinematic, any constraints connected to the body that now only contain kinematic references are removed.
Computes the world space inverse inertia tensor for the body based on the LocalInertia and Pose.
Gets a description of the body.
Description of the body.
Sets a body's properties according to a description. Properly handles any transitions between dynamic and kinematic and between shapeless and shapeful.
If the body is becoming kinematic, any constraints which only contain kinematic bodies will be removed. Wakes up the body and updates its bounds in the broad phase.
Description of the body.
Changes the shape of a body. Properly handles the transition between shapeless and shapeful. If the body is inactive, it will be forced awake. Updates the bounds of the body in the broad phase.
Index of the new shape to use for the body.
Gets a copy of the body's bounding box. If the body has no shape, the bounding box has a min at float.MaxValue and a max at float.MinValue.
Gets direct pointers to the body's bounding box minimum and maximum in the broad phase. Outputs null if the body has no shape.
Pointer to the bounding box minimum in the broad phase. Null if the body has no shape.
Pointer to the bounding box maximum in the broad phase. Null if the body has no shape.
True if the body has a shape and bounds, false otherwise.
Updates the body's bounds in the broad phase for its current state. Does not include velocity expansion. Does nothing if the body has no shape.
Can be useful if you made modifications to the body's state that you want reflected in the broad phase before the next timestep.
For example, if you want to perform ray casts against the broad phase after moving objects around directly, their bounds must be updated or else the broad phase bounds will be out of date and the ray will likely miss.
Applies an impulse to a body by index. Does not wake the body up.
Pose of the body to apply impulse to.
Velocity of the body to apply impulse to.
Local inertia of the body to apply impulse to.
Impulse to apply to the body.
World space offset from the center of the body to apply the impulse at.
Applies an impulse to a body by index. Does not wake the body up.
Body set containing the body to apply an impulse to.
Index of the body in the body set.
Impulse to apply to the body.
World space offset from the center of the body to apply the impulse at.
Applies an angular impulse to an angular velocity. Does not wake the body up.
Impulse to apply to the velocity.
Inverse inertia tensor to transform the impulse with.
Angular velocity to be modified.
Applies an impulse to a linear velocity. Does not wake the body up.
Impulse to apply to the velocity.
Inverse mass to transform the impulse with.
Linear velocity to be modified.
Applies an impulse to a body at the given world space position. Does not modify activity states.
Impulse to apply to the body.
World space offset to apply the impulse at.
Applies an impulse to a linear velocity. Does not wake the body up.
Impulse to apply to the velocity.
Computes the velocity of an offset point attached to the body.
Offset from the body's center to
Effective velocity of the point if it were attached to the body.
Applies an angular impulse to an angular velocity. Does not wake the body up.
Impulse to apply to the velocity.
Stores a group of bodies- either the set of active bodies, or the bodies involved in an inactive simulation island.
Remaps a body index to its handle.
The collidables owned by each body in the set. Speculative margins, continuity settings, and shape indices can be changed directly.
Shape indices cannot transition between pointing at a shape and pointing at nothing or vice versa without notifying the broad phase of the collidable addition or removal.
Activity states of bodies in the set.
List of constraints associated with each body in the set.
Gets whether this instance is backed by allocated memory.
Swaps the memory of two bodies. Indexed by memory slot, not by handle index.
Memory slot of the first body to swap.
Memory slot of the second body to swap.
Disposes the buffers, but nothing inside of the buffers. Per-body constraint lists stored in the set will not be returned.
Pool to return the set's top level buffers to.
Disposes the body set's buffers and any resources within them.
Pool to return resources to.
Expands the bounding box surrounding a shape A in the local space of some other collidable B.
Computes the bounding box of a child shape A in the local space of some other collidable B with a sweep direction representing the net linear motion.
Computes the bounding box of shape A in the local space of some other collidable B with a sweep direction representing the net linear motion.
Convenience collection that stores extra properties about bodies and statics, indexed by the body or static handle.
Type of the data to store.
This is built for use cases relying on random access like the narrow phase. For maximum performance with sequential access, an index-aligned structure would be better.
Constructs a new collection to store handle-aligned body properties. Assumes the Initialize function will be called later to provide the Bodies collection.
Pool from which to pull internal resources. If null, uses the later Initialize-provided Bodies pool.
Constructs a new collection to store handle-aligned body and static properties.
Simulation to track.
Pool from which to pull internal resources. If null, uses the Simulation pool.
Initializes the property collection if the Bodies/Statics-less constructor was used.
Bodies collection to track.
Statics collection to track.
Gets a reference to the properties associated with a body's handle.
Body handle to retrieve the properties for.
Reference to properties associated with a body handle.
Gets a reference to the properties associated with a static's handle.
Static handle to retrieve the properties for.
Reference to properties associated with a static handle.
Gets a reference to the properties associated with a collidable.
Collidable to retrieve the properties for.
Reference to properties associated with a collidable.
Ensures there is space for a given body handle and returns a reference to the used memory.
Body handle to allocate for.
Reference to the data for the given body.
Ensures there is space for a given static handle and returns a reference to the used memory.
Static handle to allocate for.
Reference to the data for the given static.
Ensures there is space for a given collidable reference and returns a reference to the used memory.
Collidable reference to allocate for.
Reference to the data for the given collidable.
Ensures that the internal structures have at least the given capacity for bodies.
Capacity to ensure.
Ensures that the internal structures have at least the given capacity for statics.
Capacity to ensure.
Compacts the memory used by the collection for bodies to a safe minimum based on the Bodies collection.
Compacts the memory used by the collection for statics to a safe minimum based on the Statics collection.
Returns all held resources.
Compound shape containing a bunch of shapes accessible through a tree acceleration structure. Useful for compounds with lots of children.
Acceleration structure for the compound children.
Buffer of children within this compound.
Creates a compound shape with an acceleration structure.
Set of children in the compound.
Shapes set in which child shapes are allocated.
Pool to use to allocate acceleration structures.
Type id of compound shapes.
Collision shape representing a solid cuboid.
Half of the box's width along its local X axis.
Half of the box's height along its local Y axis.
Half of the box's length along its local Z axis.
Gets or sets the width of the box along its local X axis.
Gets or sets the height of the box along its local Y axis.
Gets or sets the length of the box along its local Z axis.
Creates a Box shape.
Width of the box along the local X axis.
Height of the box along the local Y axis.
Length of the box along the local Z axis.
Type id of box shapes.
Collision shape representing a sphere-expanded line segment.
Spherical expansion applied to the internal line segment.
Half of the length of the internal line segment. Oriented along the local Y axis.
Gets or sets the length of the capsule's internal line segment along the local Y axis.
Creates a capsule shape.
Radius of the capsule.
Length of the capsule's internal line segment along the local Y axis.
Type id of capsule shapes.
No dedicated continuous detection is performed. Default speculative contact generation will occur within the speculative margin.
The collidable's bounding box will not be expanded by velocity beyond the speculative margin.
This is the cheapest mode, but it may miss collisions. Note that if a Discrete mode collidable is moving quickly, the fact that its bounding box is not expanded
may cause it to miss a collision even with a non-Discrete collidable.
No dedicated continuous detection is performed. Default speculative contact generation will occur within the speculative margin.
The collidable's bounding box will be expanded by velocity beyond the speculative margin if necessary.
This is useful when a collidable may move quickly and does not itself require continuous detection, but there exist other collidables with continuous modes
that should avoid missing collisions.
Collision detection will start with a sweep test to identify a likely time of impact. Speculative contacts will be generated for the predicted collision.
This mode can capture angular motion with very few ghost collisions. It can, however, miss secondary collisions that would have occurred due to the primary impact's velocity change.
The continuous collision detection mode.
If using ContinuousDetectionMode.Continuous, MinimumSweepTimestep is the minimum progress that the sweep test will make when searching for the first time of impact.
Collisions lasting less than MinimumProgress may be missed by the sweep test. Using larger values can significantly increase the performance of sweep tests.
If using ContinuousDetectionMode.Continuous, sweep tests will terminate if the time of impact region has been refined to be smaller than SweepConvergenceThreshold.
Values closer to zero will converge more closely to the true time of impact, but for speculative contact generation larger values usually work fine.
Larger values allow the sweep to terminate much earlier and can significantly improve sweep performance.
No dedicated continuous detection will be performed. Default speculative contact generation will occur within the speculative margin.
The collidable's bounding box will not be expanded by velocity beyond the speculative margin.
This is the cheapest mode, but it may miss collisions. Note that if a Discrete mode collidable is moving quickly, the fact that its bounding box is not expanded
may cause it to miss a collision even with a non-Discrete collidable.
No dedicated continuous detection is performed. Default speculative contact generation will occur within the speculative margin.
The collidable's bounding box will be expanded by velocity beyond the speculative margin if necessary.
This is useful when a collidable may move quickly and does not itself require continuous detection, but there exist other collidables with continuous modes
that should avoid missing collisions.
Collision detection will start with a sweep test to identify a likely time of impact. Speculative contacts will be generated for the predicted collision.
This mode can capture angular motion with very few ghost collisions. It can, however, miss secondary collisions that would have occurred due to the primary impact's velocity change.
Minimum progress that the sweep test will make when searching for the first time of impact.
Collisions lasting less than MinimumProgress may be missed by the sweep test. Using larger values can significantly increase the performance of sweep tests.
Threshold against which the time of impact region is compared for sweep termination.
If the region has been refined to be smaller than SweepConvergenceThreshold, the sweep will terminate.
Values closer to zero will converge more closely to the true time of impact, but for speculative contact generation larger values usually work fine.
Larger values allow the sweep to terminate much earlier and can significantly improve sweep performance.
Settings reflecting a continuous detection mode.
Description of a collidable instance living in the broad phase and able to generate collision pairs.
Collidables with a ShapeIndex that points to nothing (a default constructed TypedIndex) do not actually refer to any existing Collidable.
This can be used for a body which needs no collidable representation.
Continuous collision detection settings for this collidable. Includes the collision detection mode to use and tuning variables associated with those modes.
Index of the shape used by the body. While this can be changed, any transition from shapeless->shapeful or shapeful->shapeless must be reported to the broad phase.
If you need to perform such a transition, consider using Bodies.ChangeShape or Bodies.ApplyDescription; those functions update the relevant state.
Size of the margin around the surface of the shape in which contacts can be generated. These contacts will have negative depth and only contribute if the frame's velocities
would push the shapes of a pair into overlap. This should be positive to avoid jittering. It can also be used as a form of continuous collision detection, but excessively
high values combined with fast motion may result in visible 'ghost collision' artifacts.
For continuous collision detection with less chance of ghost collisions, use the dedicated continuous collision detection modes.
Index of the collidable in the broad phase. Used to look up the target location for bounding box scatters. Under normal circumstances, this should not be set externally.
Constructs a new collidable description.
Shape used by the collidable.
Radius of the margin in which to allow speculative contact generation.
Continuous collision detection settings for the collidable.
Constructs a new collidable description with default discrete continuity.
Shape used by the collidable.
Radius of the margin in which to allow speculative contact generation.
Marks a collidable as owned by a dynamic body.
Marks a collidable as owned by a kinematic body.
Marks the collidable as an independent immobile collidable.
Gets the mobility state of the owner of this collidable.
Gets the body handle of the owner of the collidable referred to by this instance.
Gets the static handle of the owner of the collidable referred to by this instance.
Gets the integer value of the handle of the owner of the collidable referred to by this instance.
Creates a collidable reference.
Mobility type of the owner of the collidable.
Handle of the owner of the collidable.
Creates a collidable reference for a body.
Mobility type of the owner of the collidable.
Handle of the owner of the collidable.
Creates a collidable reference for a static.
Mobility type of the owner of the collidable.
Handle of the owner of the collidable.
Minimalist compound shape containing a list of child shapes. Does not make use of any internal acceleration structure; should be used only with small groups of shapes.
Buffer of children within this compound.
Creates a compound shape with no acceleration structure.
Set of children in the compound.
Checks if a shape index.
Shape index to analyze.
Shape collection into which the index indexes.
True if the index is valid, false otherwise.
Checks if a set of children shape indices are all valid.
Children to examine.
Shape collection into which the children index.
True if all child indices are valid, false otherwise.
Type id of list based compound shapes.
Reusable convenience type for incrementally building compound shapes.
Weight associated with this child. Acts as the child's mass when interpreted as a dynamic compound.
When interpreted as kinematic with recentering, it is used as a local pose weight to compute the center of rotation.
Inertia tensor associated with the child. If inertia is all zeroes, it is interpreted as infinite.
Adds a new shape to the accumulator, creating a new shape in the shapes set. The mass used to compute the inertia tensor will be based on the given weight.
Type of the shape to add to the accumulator and the shapes set.
Shape to add.
Pose of the shape in the compound's local space.
Weight of the shape. If the compound is interpreted as a dynamic, this will be used as the mass and scales the inertia tensor.
Otherwise, it is used for recentering.
Adds a new shape to the accumulator, creating a new shape in the shapes set. Inertia is assumed to be infinite.
Type of the shape to add to the accumulator and the shapes set.
Shape to add.
Pose of the shape in the compound's local space.
Weight of the shape. If the compound is interpreted as a dynamic, this will be used as the mass. Otherwise, it is used for recentering.
Adds a new shape to the accumulator.
Index of the shape to add.
Pose of the shape in the compound's local space.
Weight of the shape. If the compound is interpreted as a dynamic, this will be used as the mass. Otherwise, it is used for recentering.
Inverse inertia tensor of the shape being added. This is assumed to already be scaled as desired by the weight.
Adds a new shape to the accumulator, assuming it has infinite inertia.
Index of the shape to add.
Pose of the shape in the compound's local space.
Weight of the shape used for computing the center of rotation.
Builds a buffer of compound children from the accumulated set for a dynamic compound.
Computes a center of mass and recenters child shapes relative to it. Does not reset the accumulator.
List of children created from the accumulated set.
Combined inertia of the compound.
Computed center of rotation based on the poses and weights of accumulated children.
Builds a buffer of compound children from the accumulated set for a dynamic compound. Does not recenter the children. Does not reset the accumulator.
List of children created from the accumulated set.
Combined inertia of the compound.
Builds a buffer of compound children from the accumulated set for a kinematic compound.
Computes a center of mass and recenters child shapes relative to it. Does not reset the accumulator.
List of children created from the accumulated set.
Combined inertia of the compound.
Computed center of rotation based on the poses and weights of accumulated children.
Builds a buffer of compound children from the accumulated set for a kinematic compound. Does not recenter children. Does not reset the accumulator.
List of children created from the accumulated set.
Combined inertia of the compound.
Computed center of rotation based on the poses and weights of accumulated children.
Empties out the accumulated children.
Returns internal resources to the pool, rendering the builder unusable.
Normal of the bounding plane.
Offset from the origin to a point on the plane along the normal.
Bundled points of the convex hull.
Bundled bounding planes of the convex hull.
Combined set of vertices used by each face. Use FaceToVertexIndicesStart to index into this for a particular face. Indices stored in counterclockwise winding in right handed space, clockwise in left handed space.
Start indices of faces in the FaceVertexIndices.
Creates a convex hull from a point set.
Points to compute the convex hull of.
Pool in which to allocate the convex hull and any temporary resources needed to compute the hull.
Computed center of the convex hull before the hull was recentered.
Computes the inertia of the convex hull.
Mass to scale the inertia tensor with.
Inertia of the convex hull.
Type id of convex hull shapes.
Provides an estimate of the scale of a shape.
Mask of lanes which are inactive.
Approximate scale of the shape for use in epsilons.
Stores references to the points composing one of a convex hull's faces.
Gets the number of vertices in the face.
Gets the index of the vertex associated with the given face vertex index in the source point set.
Index into the face's vertex list.
Index of the vertex associated with the given face vertex index in the source point set.
Raw data representing a convex hull.
This is not yet transformed into a runtime format. It requires additional processing to be used in a ConvexHull shape; see ConvexHullHelper.ProcessHull.
Mapping of points on the convex hull back to the original point set.
List of indices composing the faces of the hull. Individual faces indexed by the FaceIndices.
Starting index in the FaceVertexIndices for each face.
Helper methods to create and process convex hulls from point clouds.
Computes the convex hull of a set of points.
Point set to compute the convex hull of.
Buffer pool to pull memory from when creating the hull.
Convex hull of the input point set.
Processes hull data into a runtime usable convex hull shape. Recenters the convex hull's points around its center of mass.
Point array into which the hull data indexes.
Raw input data to process.
Pool used to allocate resources for the hullShape.
Convex hull shape created from the input data.
Computed center of mass of the convex hull before its points were recentered onto the origin.
Creates a convex hull shape out of an input point set. Recenters the convex hull's points around its center of mass.
Points to use to create the hull.
Buffer pool used for temporary allocations and the output data structures.
Intermediate hull data that got processed into the convex hull.
Computed center of mass of the convex hull before its points were recentered onto the origin.
Convex hull shape of the input point set.
Creates a convex hull shape out of an input point set. Recenters the convex hull's points around its center of mass.
Points to use to create the hull.
Buffer pool used for temporary allocations and the output data structures.
Computed center of mass of the convex hull before its points were recentered onto the origin.
Convex hull shape of the input point set.
Collision shape representing a cylinder.
Radius of the cylinder.
Half length of the cylinder along its local Y axis.
Gets or sets the length of the cylinder along its local Y axis.
Creates a cylinder shape.
Radius of the cylinder.
Length of the cylinder along its local Y axis.
Type id of cylinder shapes.
Defines a type usable as a shape by collidables.
Defines a compound shape type that has children of potentially different types.
Defines a compound shape type that has children of only one type.
Type of the child shapes.
Type of the child shapes, formatted in AOSOA layout.
Gets whether this type supports accessing its memory by lane offsets. If false, WriteSlot must be used instead of WriteFirst.
Gets the number of bytes required for allocations within the wide shape.
For types with a nonzero internal allocation size, provides memory to the shape for internal allocations.
Memory should be assumed to be stack allocated.
Memory to use for internal allocations in the wide shape.
Places the specified AOS-formatted shape into the first lane of the wide 'this' reference.
Note that we are effectively using the TShapeWide as a stride.
The base address is offset by the user of this function, so the implementation only ever considers the first slot.
AOS-formatted shape to gather from.
Places the specified AOS-formatted shape into the selected slot of the wide 'this' reference.
Index of the slot to put the data into.
Source of the data to insert.
Gets the lower bound on the number of rays to execute in a wide fashion. Ray bundles with fewer rays will fall back to the single ray code path.
Shape designed to contain a whole bunch of triangles. Triangle collisions and ray tests are one-sided; only tests which see the triangle as wound clockwise in right handed coordinates or counterclockwise in left handed coordinates will generate contacts.
Acceleration structure of the mesh.
Buffer of triangles composing the mesh. Triangles will only collide with tests which see the triangle as wound clockwise in right handed coordinates or counterclockwise in left handed coordinates.
Gets or sets the scale of the mesh.
Creates a mesh shape.
Triangles to use in the mesh.
Scale to apply to all vertices at runtime.
Note that the scale is not baked into the triangles or acceleration structure; the same set of triangles and acceleration structure can be used across multiple Mesh instances with different scales.
Pool used to allocate acceleration structures.
Loads a mesh from data stored in a byte buffer previously stored by the Serialize function.
Data to load the mesh from.
Pool to create the mesh with.
Gets the number of bytes it would take to store the given mesh in a byte buffer.
Mesh to measure.
Number of bytes it would take to store the mesh.
Writes a mesh's data to a byte buffer.
Mesh to write into the byte buffer.
Byte buffer to store the mesh in.
Casts a ray against the mesh. Executes a callback for every test candidate and every hit.
Type of the callback to execute for every test candidate and hit.
Pose of the mesh during the ray test.
Ray to test against the mesh.
Maximum length of the ray in units of the ray direction length.
Callback to execute for every hit.
Casts a bunch of rays against the mesh at the same time, executing a callback for every test candidate and every hit.
Type of the callback to execute for every ray test candidate and every hit.
Pose of the mesh during the ray test.
Set of rays to cast against the mesh.
Callbacks to execute.
Subtracts the newCenter from all points in the mesh hull.
New center that all points will be made relative to.
Computes the inertia of the mesh around its volumetric center and recenters the points of the mesh around it.
Assumes the mesh is closed and should be treated as solid.
Mass to scale the inertia tensor with.
Inertia tensor of the closed mesh.
Center of the closed mesh.
Computes the inertia of the mesh.
Assumes the mesh is closed and should be treated as solid.
Mass to scale the inertia tensor with.
Inertia of the closed mesh.
Computes the volume and center of mass of the mesh. Assumes the mesh is closed and should be treated as solid.
Volume of the closed mesh.
Center of mass of the closed mesh.
Computes the center of mass of the mesh.
Assumes the mesh is closed and should be treated as solid.
Center of mass of the closed mesh.
Computes the inertia of the mesh around its volumetric center and recenters the points of the mesh around it.
Assumes the mesh is open and should be treated as a triangle soup.
Mass to scale the inertia tensor with.
Inertia tensor of the closed mesh.
Center of the open mesh.
Computes the inertia of the mesh.
Assumes the mesh is open and should be treated as a triangle soup.
Mass to scale the inertia tensor with.
Inertia of the open mesh.
Computes the center of mass of the mesh.
Assumes the mesh is open and should be treated as a triangle soup.
Center of mass of the open mesh.
Returns the mesh's resources to a buffer pool.
Pool to return the mesh's resources to.
Type id of mesh shapes.
Defines a type capable of providing a sequence of triangles.
Gets the next triangle in the sequence, if any.
First vertex in the triangle.
Second vertex in the triangle.
Third vertex in the triangle.
True if there was another triangle, false otherwise.
Provides helpers for computing the inertia of objects with triangular surfaces.
Computes the signed volume of a tetrahedron where the fourth vertex is at the origin.
Triangles visible from outside the shape are assumed to have clockwise winding in right handed coordinates or counterclockwise winding in left handed coordinates.
First vertex of the tetrahedron.
Second vertex of the tetrahedron.
Third vertex of the tetrahedron.
Volume of the tetrahedron.
Integrates the inertia contribution of a tetrahedron with vertices at a, b, c, and (0,0,0) assuming a density of 1.
First vertex of the tetrahedron.
Second vertex of the tetrahedron.
Third vertex of the tetrahedron.
Volume of the tetrahedron.
Inertia tensor of this tetrahedron assuming a density of 1.
Computes the inertia of a closed mesh.
Triangles visible from outside the shape are assumed to have clockwise winding in right handed coordinates or counterclockwise winding in left handed coordinates.
Type of the triangle source.
Source from which to retrieve a sequence of triangles.
Mass of the mesh to scale the inertia tensor with.
Volume of the mesh.
Inertia tensor of the mesh.
Computes the inertia of a closed mesh.
Triangles visible from outside the shape are assumed to have clockwise winding in right handed coordinates or counterclockwise winding in left handed coordinates.
Type of the triangle source.
Source from which to retrieve a sequence of triangles.
Mass of the mesh to scale the inertia tensor with.
Volume of the mesh.
Inertia tensor of the mesh.
Center of mass of the mesh.
Computes the center of mass of a closed mesh.
Type of the triangle source.
Source from which to retrieve a sequence of triangles.
Volume of the mesh.
Center of mass of the mesh.
Integrates the inertia contribution from a single triangle.
First vertex in the triangle.
Second vertex in the triangle.
Third vertex in the triangle.
Mass of the triangle.
Inertia tensor of the triangle.
Computes the area of a triangle.
First vertex in the triangle.
Second vertex in the triangle.
Third vertex in the triangle.
Area of the triangle.
Integrates the inertia contribution from a single triangle assuming a density of 1.
First vertex in the triangle.
Second vertex in the triangle.
Third vertex in the triangle.
Area of the triangle.
Inertia tensor of the triangle assuming that the density is 1.
Computes the inertia of an open mesh, treating it as a triangle soup.
Type of the triangle source.
Source from which to retrieve a sequence of triangles.
Mass of the mesh to scale the inertia tensor with.
Inertia tensor of the mesh.
Computes the inertia of an open mesh, treating it as a triangle soup.
Type of the triangle source.
Source from which to retrieve a sequence of triangles.
Mass of the mesh to scale the inertia tensor with.
Inertia tensor of the mesh.
Center of mass of the mesh.
Computes the center of mass of an open mesh, treating it as a triangle soup.
Type of the triangle source.
Source from which to retrieve a sequence of triangles.
Center of mass of the mesh.
Computes an offset for an inertia tensor based on an offset frame of reference.
Mass associated with the inertia tensor being moved.
Offset from the current inertia frame of reference to the new frame of reference.
Modification to add to the inertia tensor to move it into the new reference frame.
Gets the number of shapes that the batch can currently hold without resizing.
Gets the type id of the shape type in this batch.
Gets whether this shape batch's contained type potentially contains children that require other shape batches.
Gets the size of the shape type stored in this batch in bytes.
Gets a raw untyped pointer to a shape's data.
Index of the shape to look up.
Pointer to the indexed shape data.
Size of the shape data in bytes.
Frees all shape slots without returning any resources to the pool.
Increases the size of the type batch if necessary to hold the target capacity.
Target capacity.
Changes the size of the type batch if the target capacity is different than the current capacity. Note that shrinking allocations is conservative; resizing will
never allow an existing shape to point to unallocated memory.
Target capacity.
Returns all backing resources to the pool, leaving the batch in an unusable state.
Shrinks or expands the allocation of the batch's id pool. Note that shrinking allocations is conservative; resizing will never allow any pending ids to be lost.
Number of slots to allocate space for in the id pool.
Gets a reference to the shape associated with an index.
Index of the shape reference to retrieve.
Reference to the shape at the given index.
Computes a bounding box for a single shape.
Pose to calculate the bounding box of.
Index of the shape.
Bounding box of the specified shape with the specified pose.
Removes a shape and any existing children from the shapes collection and returns their resources to the given pool.
Index of the shape to remove.
Pool to return all shape resources to.
Removes a shape from the shapes collection and returns its resources to the given pool. Does not remove or dispose any children.
Index of the shape to remove.
Pool to return all shape resources to.
Removes a shape without removing its children or disposing any resources.
Index of the shape to remove.
Clears all shapes from existing batches. Does not release any memory.
Ensures a minimum capacity for all existing shape batches.
Capacity to ensure for all existing shape batches.
Resizes all existing batches for a target capacity. Note that this is conservative; it will never orphan an existing shape.
Capacity to target for all existing shape batches.
Releases all memory from existing batches. Leaves shapes set in an unusable state.
Radius of the sphere.
Creates a sphere shape.
Radius of the sphere.
Type id of sphere shapes.
Collision shape representing an individual triangle. Triangle collisions and ray tests are one-sided; only tests which see the triangle as wound clockwise in right handed coordinates or counterclockwise in left handed coordinates will generate contacts.
First vertex of the triangle in local space.
Second vertex of the triangle in local space.
Third vertex of the triangle in local space.
Creates a triangle shape.
First vertex of the triangle in local space.
Second vertex of the triangle in local space.
Third vertex of the triangle in local space.
Type id of triangle shapes.
Provides an estimate of the scale of a shape.
Approximate scale of the shape for use in epsilons.
Minimum dot product between the detected local normal and the face normal of a triangle necessary to create contacts.
Epsilon to apply to testing triangles for degeneracy (which will be scaled by a pair-determined epsilon scale). Degenerate triangles do not have well defined normals and should not contribute
Bit packed representation of the typed index.
Gets the type index of the object.
Gets the index of the object.
Gets whether this index actually refers to anything. The Type and Index should only be used if this is true.
Gets the index of the body associated with this continuation.
Gets whether this continuation is associated with a compound's child.
Creates a bounding box calculation continuation for a given noncompound body.
Index of the body to set the bounding box of.
Creates a bounding box calculation continuation for a given compound body.
Index of the compound body to set the bounding box of.
The number of bodies to accumulate per type before executing an AABB update. The more bodies per batch, the less virtual overhead and execution divergence.
However, this should be kept low enough such that the data that has to be gathered by the bounding box update is still usually in L1.
Manages scene acceleration structures for collision detection and queries.
Collidable references contained within the . Note that values at or beyond the .LeafCount are not defined.
Collidable references contained within the . Note that values at or beyond .LeafCount are not defined.
Pool used by the broad phase.
Tree containing wakeful bodies.
Tree containing sleeping bodies and statics.
Applies updated bounds to the given leaf index in the given tree, refitting the tree to match.
Index of the leaf in the tree to update.
Tree containing the leaf to update.
New minimum bounds for the leaf.
New maximum bounds for the leaf.
Applies updated bounds to the given active leaf index, refitting the tree to match.
Index of the leaf to update.
New minimum bounds for the leaf.
New maximum bounds for the leaf.
Applies updated bounds to the given active leaf index, refitting the tree to match.
Index of the leaf to update.
New minimum bounds for the leaf.
New maximum bounds for the leaf.
Clears out the broad phase's structures without releasing any resources.
Ensures that the broad phase structures can hold at least the given number of leaves.
Number of leaves to allocate space for in the active tree.
Number of leaves to allocate space for in the static tree.
Resizes the broad phase structures to hold the given number of leaves. Note that this is conservative; it will never orphan any existing leaves.
Number of leaves to allocate space for in the active tree.
Number of leaves to allocate space for in the static tree.
Releases memory used by the broad phase. Leaves the broad phase unusable.
Finds any intersections between a ray and leaf bounding boxes.
Type of the callback to execute on ray-leaf bounding box intersections.
Origin of the ray to cast.
Direction of the ray to cast.
Maximum length of the ray traversal in units of the direction's length.
Callback to execute on ray-leaf bounding box intersections.
User specified id of the ray.
Finds any intersections between a swept bounding box and leaf bounding boxes.
Type of the callback to execute on sweep-leaf bounding box intersections.
Minimum bounds of the box to sweep.
Maximum bounds of the box to sweep.
Direction along which to sweep the bounding box.
Maximum length of the sweep in units of the direction's length.
Callback to execute on sweep-leaf bounding box intersections.
Finds any intersections between a swept bounding box and leaf bounding boxes.
Type of the callback to execute on sweep-leaf bounding box intersections.
Bounding box to sweep.
Direction along which to sweep the bounding box.
Maximum length of the sweep in units of the direction's length.
Callback to execute on sweep-leaf bounding box intersections.
Finds any overlaps between a bounding box and leaf bounding boxes.
Type of the enumerator to call for overlaps.
Minimum bounds of the query box.
Maximum bounds of the query box.
Enumerator to call for overlaps.
Finds any overlaps between a bounding box and leaf bounding boxes.
Type of the enumerator to call for overlaps.
Query box bounds.
Enumerator to call for overlaps.
Defines a type that can act as a callback for broad phase sweep tests.
Timestep duration used by pairs which rely on velocity to compute local bounding boxes for pruning.
Forces any remaining partial batches to execute and disposes the batcher.
Reports the result of a convex collision test to the callbacks and, if necessary, to any continuations for postprocessing.
Unless you're building custom compound collision pairs or adding new contact processing continuations, you can safely ignore this.
Contacts detected for the pair.
Continuation describing the pair and what to do with it.
Submits a subpair whose testing was blocked by user callback as complete to any relevant continuations.
Unless you're building custom compound collision pairs or adding new contact processing continuations, you can safely ignore this.
Continuation describing the pair and what to do with it.
Defines a type which includes information necessary to apply some form of post processing to a collision test result.
Creates a collision test continuation with the given number of slots for subpairs.
Number of subpair slots to include in the continuation.
Pool to take resources from.
Handles what to do next when the child pair has finished execution and the resulting manifold is available.
Type of the callbacks used in the batcher.
Continuation instance being considered.
Contact manifold for the child pair.
Collision batcher processing the pair.
Handles what to do next when the child pair was rejected for testing, and no manifold exists.
Type of the callbacks used in the batcher.
Continuation instance being considered.
Collision batcher processing the pair.
Checks if the parent pair is complete and should be flushed.
Type of the callbacks used in the batcher.
Id of the pair to attempt to flush.
Collision batcher processing the pair.
True if the pair was done and got flushed, false otherwise.
Describes the flow control to apply to a convex-convex pair report.
Marks a pair as requiring no further processing before being reported to the user supplied continuations.
Marks a pair as part of a set of a higher (potentially multi-manifold) pair, potentially requiring contact reduction.
Marks a pair as a part of a set of mesh-convex collisions, potentially requiring mesh boundary smoothing.
Marks a pair as a part of a set of mesh-convex collisions spawned by a mesh-compound pair, potentially requiring mesh boundary smoothing.
Provides control over subtask generated results before they are reported to the parent task.
Id of the parent pair that spawned this child pair.
Index of the child belonging to collidable A in the subpair under consideration.
Index of the child belonging to collidable B in the subpair under consideration.
Manifold of the child pair to configure.
Checks whether further collision testing should be performed for a given subtask.
Id of the parent pair.
Index of the child belonging to collidable A in the subpair under consideration.
Index of the child belonging to collidable B in the subpair under consideration.
True if testing should proceed, false otherwise.
Gets the number of tasks to batch together before executing this task.
Gets the first shape type index associated with the task. Shape pairs provided to the task for execution should be in the order defined by these type two indices.
If a collision task isn't a top level shape pair task, this should be -1.
Gets the second shape type index associated with the task. Shape pairs provided to the task for execution should be in the order defined by these type two indices.
If a collision task isn't a top level shape pair task, this should be -1.
Gets whether the task is capable of generating subtasks. Note that subtask generators cannot generate subtasks that are themselves subtask generators.
Gets the pair type that the ExecuteBatch call requires.
Executes the task on the given input.
Type of the callbacks used to handle results of collision tasks.
Batcher responsible for the invocation.
Batch of pairs to test.
Continuations to invoke upon completion of a top level pair.
Filters to use to influence execution of the collision tasks.
General pair for two shapes with full pose and flip mask, but no bounds related data.
Pair specialized for convex pairs between two shapes of the same type.
Pair specialized for two spheres, requiring no flip mask or orientations.
Pair specialized for convex pairs that involve one sphere which requires no orientation.
Pair that requires computing local bounding boxes, and so requires extra information like velocity.
Gets the nubmer of pairs which would ideally be gathered together before executing a wide test.
Defines a type that holds scalar data for the collision batcher.
Gets the enumeration type associated with this pair type.
Stores whether the types involved in pair require that the resulting contact manifold be flipped to be consistent with the user-requested pair order.
Stores whether the types involved in pair require that the resulting contact manifold be flipped to be consistent with the user-requested pair order.
Pair of objects awaiting collision processing that involves velocities for bounds calculation.
Type of the first shape in the pair.
Type of the second shape in the pair.
Gets the cache's type id.
Note that this is not the same as a constraint type id or other type ids; it only refers to the type of the caches for storage within the PairCache's structures.
Accumulates constraints to remove from multiple threads, and efficiently removes them all as a batch.
Processes enqueued constraint removals and prepares removal jobs.
True if the constraint remover should maintain determinism at an added cost, false otherwise.
The number of removal jobs created. To complete the jobs, execute RemoveConstraintsFromTypeBatch for every index from 0 to the returned job count.
Returns the handles associated with all removed constraints to the solver's handle pool.
For uses of the ConstraintRemover that fully remove a constraint from the simulation (rather than simply moving it somewhere else),
the handle->constraint mapping must be updated. This has to wait until after the multithreaded operations actually complete to avoid corrupting parallel operations.
Provides indirection for reading from and updating constraints in the narrow phase.
This, like many other similar constructions in the engine, could conceptually be replaced by static function pointers and a few supplementary data fields.
We probably will do exactly that at some point.
Extracts references to data from a contact constraint of the accessor's type.
Type of the extractor to handle the extracted references.
Handle of the contact constraint to extract.
Solver in which the constraint lives.
Extractor to handle the extracted references.
Extracts references to data from a contact constraint of the accessor's type.
Type of the extractor to handle the extracted references.
Location of the constraint in the solver.
Solver in which the constraint lives.
Extractor to handle the extracted references.
Extracts references to data from a contact constraint of the accessor's type.
Type of the extractor to handle the extracted references.
Handle of the contact constraint to extract.
Solver in which the constraint lives.
Extractor to handle the extracted references.
Extracts references to data from a contact constraint of the accessor's type.
Type of the extractor to handle the extracted references.
Location of the constraint in the solver.
Solver in which the constraint lives.
Extractor to handle the extracted references.
Information about a single contact in a nonconvex collidable pair.
Nonconvex pairs can have different surface bases at each contact point, since the contact surface is not guaranteed to be a plane.
Offset from the position of collidable A to the contact position.
Penetration depth between the two collidables at this contact. Negative values represent separation.
Surface basis of the contact. If transformed into a rotation matrix, X and Z represent tangent directions and Y represents the contact normal. Points from collidable B to collidable A.
Id of the features involved in the collision that generated this contact. If a contact has the same feature id as in a previous frame, it is an indication that the
same parts of the shape contributed to its creation. This is useful for carrying information from frame to frame.
Information about a single contact in a convex collidable pair. Convex collidable pairs share one surface basis across the manifold, since the contact surface is guaranteed to be a plane.
Offset from the position of collidable A to the contact position.
Penetration depth between the two collidables at this contact. Negative values represent separation.
Id of the features involved in the collision that generated this contact. If a contact has the same feature id as in a previous frame, it is an indication that the
same parts of the shape contributed to its creation. This is useful for carrying information from frame to frame.
Gets the number of contacts in the manifold.
Gets whether the contact manifold was created by a pair of convex objects or not. True if convex, false if nonconvex.
Retrieves the feature id associated with a requested contact.
Index of the contact to grab the feature id of.
Feature id of the requested contact.
Retrieves a copy of a contact's data.
Index of the contact to copy data from.
Offset from the first collidable's position to the contact position.
Normal of the contact surface at the requested contact. Points from collidable B to collidable A.
Penetration depth at the requested contact.
Feature id of the requested contact.
Feature ids represent which parts of the collidables formed the contact and can be used to track unique contacts across frames.
Pulls a reference to a contact's depth.
Manifold to pull a reference from.
Contact to pull data from.
Reference to a contact's depth.
Pulls a reference to a contact's normal. Points from collidable B to collidable A. For convex manifolds that share a normal, all contact indices will simply return a reference to the manifold-wide normal.
Manifold to pull a reference from.
Contact to pull data from.
Reference to a contact's normal (or the manifold-wide normal in a convex manifold).
Pulls a reference to a contact's offset.
Manifold to pull a reference from.
Contact to pull data from.
Reference to a contact's offset.
Pulls a reference to a contact's feature id.
Manifold to pull a reference from.
Contact to pull data from.
Reference to a contact's feature id.
Contains the data associated with a nonconvex contact manifold.
Offset from collidable A to collidable B.
The maximum number of contacts that can exist within a nonconvex manifold.
Retrieves a copy of a contact's data.
Index of the contact to copy data from.
Offset from the first collidable's position to the contact position.
Normal of the contact surface at the requested contact. Points from collidable B to collidable A.
Penetration depth at the requested contact.
Feature id of the requested contact.
Feature ids represent which parts of the collidables formed the contact and can be used to track unique contacts across frames.
Retrieves the feature id associated with a requested contact.
Index of the contact to grab the feature id of.
Feature id of the requested contact.
Pulls a reference to a contact's depth.
Manifold to pull a reference from.
Contact to pull data from.
Reference to a contact's depth.
Pulls a reference to a contact's normal. Points from collidable B to collidable A.
Manifold to pull a reference from.
Contact to pull data from.
Reference to a contact's normal.
Pulls a reference to a contact's offset.
Manifold to pull a reference from.
Contact to pull data from.
Reference to a contact's offset.
Pulls a reference to a contact's feature id.
Manifold to pull a reference from.
Contact to pull data from.
Reference to a contact's feature id.
Contains the data associated with a convex contact manifold.
Offset from collidable A to collidable B.
Surface normal shared by all contacts. Points from collidable B to collidable A.
Retrieves the feature id associated with a requested contact.
Index of the contact to grab the feature id of.
Feature id of the requested contact.
Retrieves a copy of a contact's data.
Index of the contact to copy data from.
Offset from the first collidable's position to the contact position.
Normal of the contact surface at the requested contact. Points from collidable B to collidable A.
Penetration depth at the requested contact.
Feature id of the requested contact.
Feature ids represent which parts of the collidables formed the contact and can be used to track unique contacts across frames.
Pulls a reference to a contact's depth.
Manifold to pull a reference from.
Contact to pull data from.
Reference to a contact's depth.
Pulls a reference to a contact manifold's normal. Points from collidable B to collidable A. Convex manifolds share a single normal across all contacts.
Manifold to pull a reference from.
Contact to pull data from.
Reference to the contact manifold's normal.
Pulls a reference to a contact's offset.
Manifold to pull a reference from.
Contact to pull data from.
Reference to a contact's offset.
Pulls a reference to a contact's feature id.
Manifold to pull a reference from.
Contact to pull data from.
Reference to a contact's feature id.
Gets the index of the continuation.
Gets the type index of the continuation.
Gets whether this index actually refers to anything. The Type and Index should only be used if this is true.
Coefficient of friction to apply for the constraint. Maximum friction force will be equal to the normal force times the friction coefficient.
Maximum relative velocity along the contact normal at which the collision constraint will recover from penetration. Clamps the velocity goal created from the spring settings.
Defines the constraint's penetration recovery spring properties.
Performs any required initialization logic after the Simulation instance has been constructed.
Simulation that owns these callbacks.
Chooses whether to allow contact generation to proceed for two overlapping collidables.
Index of the worker that identified the overlap.
Reference to the first collidable in the pair.
Reference to the second collidable in the pair.
True if collision detection should proceed, false otherwise.
Provides a notification that a manifold has been created for a pair. Offers an opportunity to change the manifold's details.
Index of the worker thread that created this manifold.
Pair of collidables that the manifold was detected between.
Set of contacts detected between the collidables.
Material properties of the manifold.
True if a constraint should be created for the manifold, false otherwise.
Chooses whether to allow contact generation to proceed for the children of two overlapping collidables in a compound-including pair.
Parent pair of the two child collidables.
Index of the child of collidable A in the pair. If collidable A is not compound, then this is always 0.
Index of the child of collidable B in the pair. If collidable B is not compound, then this is always 0.
True if collision detection should proceed, false otherwise.
This is called for each sub-overlap in a collidable pair involving compound collidables. If neither collidable in a pair is compound, this will not be called.
For compound-including pairs, if the earlier call to AllowContactGeneration returns false for owning pair, this will not be called. Note that it is possible
for this function to be called twice for the same subpair if the pair has continuous collision detection enabled;
the CCD sweep test that runs before the contact generation test also asks before performing child pair tests.
Provides a notification that a manifold has been created between the children of two collidables in a compound-including pair.
Offers an opportunity to change the manifold's details.
Index of the worker thread that created this manifold.
Pair of collidables that the manifold was detected between.
Index of the child of collidable A in the pair. If collidable A is not compound, then this is always 0.
Index of the child of collidable B in the pair. If collidable B is not compound, then this is always 0.
Set of contacts detected between the collidables.
True if this manifold should be considered for constraint generation, false otherwise.
Releases any resources held by the callbacks. Called by the owning narrow phase when it is being disposed.
Gets whether the support finder is sampling a shape with a spherical margin that should be applied after a solution is found for the core shape.
Margin associated with the shape according to this support finder.
Shape to find the margin of.
Margin of the shape.
Flag used to mark a contact as being generated by the face of a triangle in its feature id.
Minimum dot product between a triangle face and the contact normal for a collision to be considered a triangle face contact.
True if the manifold associated with this triangle has been blocked due to its detected infringement on another triangle, false otherwise.
True if the triangle did not act as a blocker for any other manifold and so can be removed if it is blocked, false otherwise.
Normal of a triangle detected as being infringed by the manifold associated with this triangle in mesh space.
Looks up the contact constraint accessor for the given constraint type id if it exists.
Constraint type id to look up a constraint accessor for.
Accessor for the given type id.
True if the constraint type id refers to a registered accessor, false otherwise.
Tries to extract contact prestep, impulse, and body reference data from the given handle. If it's not a contact constraint, returns false.
Type of the extractor used to collect contact data from the solver.
Constraint to try to extract data from.
Extractor used to collect contact data from the solver.
True if the constraint was a contact type, false otherwise.
Tries to extract prestep and impulse contact data from the given handle. If it's not a contact constraint, returns false.
Type of the extractor used to collect contact data from the solver.
Constraint to try to extract data from.
Extractor used to collect contact data from the solver.
True if the constraint was a contact type, false otherwise.
Gets whether a constraint type id maps to a contact constraint.
Id of the constraint to check.
True if the type id refers to a contact constraint. False otherwise.
Turns broad phase overlaps into contact manifolds and uses them to manage constraints in the solver.
Type of the callbacks to use.
When notified of a new constraint, immediately adds it to the solver.
Pair which will directly produce constraints.
Pair which samples a swept location for contacts and needs to be rewound to compute proper speculative depths in a post process.
Flushes pending constraints into the simulation without any form of synchronization. Adds occur in the order of manifold generation.
If the contact manifold generation is deterministic, then the result of this add will be deterministic.
Flushes pending constraints into the simulation without any form of synchronization. Adds occur in the order of manifold generation.
If the contact manifold generation is deterministic, then the result of this add will be deterministic.
Associated with a pair of two collidables that each are controlled by bodies.
Special type for collision pairs that do not need to store any supplementary information.
Phase one job in the awakener. JobIndex used to identify sub-job.
Sorts the constraints of a single type across all workers. Used by deterministic preflushes to schedule adds.
Accesses no buffer pools; memory is allocated and returned on main thread.
Identifies a first guess at the constraint batch to which every new constraint should be added to.
Accesses no buffer pools; memory is allocated and returned on main thread.
Adds constraints to the solver and constraint graph in an order determined by the previous sorts and with the help of the speculatively computed batch targets. Locally sequential.
Accesses main thread buffer pool when type batches are created or resized.
Adds constraints to the solver and constraint graph in an order determined by the collision detection phase. If the collision detection phase is nondeterministic due to threading, then
this will result in nondeterministic adds to the solver.
Accesses main thread buffer pool when type batches are created or resized.
Phase two job in the awakener. JobIndex used to identify sub-job.
Check the freshness bytes in a region to remove stale pairs.
Start region of a CheckFreshness or SpeculativeConstraintBatchSearch job.
End region of a CheckFreshness or SpeculativeConstraintBatchSearch job.
Narrow phase constraint type index targeted by a SpeculativeConstraintBatchSearch or SortContactConstraintType.
Index of the worker in which a range of constraints starts.
Used by SpeculativeConstraintBatchSearch.
Number of worker threads containing constraints to read in the SortContactConstraintType and NondeterministicConstraintAdd tasks.
Index of the job. Used by AwakenerPhaseOne and AwakenerPhaseTwo tasks.
Offset from the origin of the first shape's parent to the child's location in world space. If there is no parent, this is the zero vector.
Offset from the origin of the second shape's parent to the child's location in world space. If there is no parent, this is the zero vector.
A narrowphase-specific type and index into the pair cache's constraint data set. Collision pairs which have no associated constraint, either
because no contacts were generated or because the constraint was filtered, will have a nonexistent ConstraintCache.
A narrowphase-specific type and index into a batch of custom data for the pair. Many types do not use any supplementary data, but some make use of temporal coherence
to accelerate contact generation.
Per-pair 'freshness' flags set when a pair is added or updated by the narrow phase execution. Only initialized for the duration of the narrowphase's execution.
This stores one byte per pair. While it could be compressed to 1 bit, that requires manually ensuring thread safety. By using bytes, we rely on the
atomic setting behavior for data types no larger than the native pointer size. Further, smaller sizes actually pay a higher price in terms of increased false sharing.
Choice of data type is a balancing act between the memory bandwidth of the post analysis and the frequency of false sharing.
Flush all deferred changes from the last narrow phase execution.
Completes the addition of a constraint by filling in the narrowphase's pointer to the constraint and by distributing accumulated impulses.
Count-specialized type containing cached accumulated impulses.
Narrow phase that triggered the constraint add.
Solver containing the constraint to set the impulses of.
Warm starting impulses to apply to the contact constraint.
Index of the constraint cache to update.
Constraint handle associated with the constraint cache being updated.
Collidable pair associated with the new constraint.
Mapping from constraint handle back to collision detection pair cache locations.
Packed indirection to data associated with a pair cache entry.
Gets whether this index actually refers to anything. The Type and Index should only be used if this is true.
Gets whether this index refers to an active cache entry. If false, the entry exists in an inactive set.
Gets the index of the cache that owns the entry.
Gets the type index of the object.
Gets the index of the object within the type specific list.
Helps test the broad phase's active and static trees with a custom leaf tester.
Type used to test rays against leaves.
Constructs a ray batcher for the broad phase and initializes its backing resources.
Pool to pull resources from.
Ray tester used to test leaves found by the broad phase tree traversals.
Maximum number of rays to execute in each traversal.
This should typically be chosen as the highest value which avoids spilling data out of L2 cache.
Adds a ray to the batcher to test against the broad phase trees.
If the underlying ray batcher hits its maximum capacity, all the accumulated rays will be tested against the broad phase trees and the accumulator will be reset.
Origin of the ray to test against the tree.
Direction of the ray to test against the tree.
Maximum distance that the ray will travel in units of the ray's length.
Identifier value for the ray. Leaf tests will have access to the id.
Tests any accumulated rays against the broad phase trees and then resets the batcher.
Disposes the underlying batcher resources.
Tests batches of rays against the simulation.
Type used to handle hits against objects in the simulation.
Adds a ray to the batcher to test against the simulation.
If the underlying ray batcher hits its maximum capacity, all the accumulated rays will be tested against the simulation and the accumulator will be reset.
Origin of the ray to test against the simulation.
Direction of the ray to test against the simulation.
Maximum distance that the ray will travel in units of the ray's length.
Identifier value for the ray. Callbacks will have access to the id.
Tests any accumulated rays against the broad phase trees and then resets the batcher.
Gets the first shape type index associated with the task.
Gets the second shape type index associated with the task.
Allocates an element in the list, initializing the backing buffer if needed.
Number of bytes per element.
Minimum size of the backing buffer to create if this is a new allocation.
Pool to pull allocations from.
Index of the element in bytes within the list's buffer.
Helper class for creating runtime specialized vectorized ray intersection tests with shapes that support broadcasting.
The cached pair data created by a single worker during the last execution of narrow phase pair processing.
The set of pair-pointer associations created by this worker that should be added to the pair mapping.
The set of pairs to remove from the pair cache generated by the worker.
Contains a set of type batches whose constraints share no body references.
Gets a type batch in the batch matching the given type id.
Requires that there exists at least one constraint in the type batch.
Id of the TypeBatch's type to retrieve.
TypeBatch instance associated with the given type.
Gets a pointer to the type batch in the batch matching the given type id.
Requires that there exists at least one constraint in the type batch.
Id of the TypeBatch's type to retrieve.
TypeBatch instance associated with the given type.
Ensures that all type batches within this constraint batch meet or exceed the size requirements of the per-type capacities defined by the solver.
Solver to pull minimum capacities from.
Applies the solver-defined minimum capacities to existing type batches.
Solver to pull minimum capacities from.
Releases all memory used by the batch.
Enumerates the bodies attached to an active constraint and removes the constraint's handle from all of the connected body constraint reference lists.
Index of the target constraint bundle to optimize.
Index of the last optimized type batch.
Index of the last optimized batch.
If true, regions are offset by a half region width. Toggled each frame. Offsets allow the sorted regions to intermix, eventually converging to a full sort.
Gets the total number of bundles across all types and batches.
Gets the total number of bundles across all types and batches.
Gets whether this constraint set is allocated.
Constrains two bodies to rotate around a local axis attached to body A at a target velocity.
Axis of rotation in body A's local space.
Target relative angular velocity around the axis.
Motor control parameters.
Angular component of a hinge. Constrains the angular degrees of freedom of two bodies such that they can only rotate relative to each other around the hinge's axis.
Hinge axis in the local space of A.
Hinge axis in the local space of B.
Spring frequency and damping parameters.
Constrains the relative angular velocity between two bodies to a target.
Target relative angular velocity between A and B, stored in A's local space. Target world space angular velocity of B is AngularVelocityA + TargetVelocityLocalA * OrientationA.
Motor control parameters.
Constrains two bodies to have a target relative rotation.
The target relative rotation from body A to body B in body A's local space. The constraint tries to maintain OrientationB = TargetRelativeRotationLocalA * OrientationA.
Spring frequency and damping parameters.
Servo control parameters.
Constrains two bodies with the angular component of a swivel hinge that allows rotation around two axes, like a laptop monitor hinge that allows flipping the screen.
Swivel axis in the local space of body A.
Hinge axis in the local space of body B.
Spring frequency and damping parameters.
Constrains the area of a triangle connecting the centers of three bodies to match a goal area.
Scaled volume computed from ||ab x ac||.
2 times the target area of the triangle. Computed from ||ab x ac||.
Spring frequency and damping parameters.
Creates a new area constraint, initializing the target area using a set of initial positions.
Initial position of the first body.
Initial position of the second body.
Initial position of the third body.
Spring settings to apply to the volume constraint.
Handles the solve iterations of a bunch of ball socket constraints.
Constrains a point on one body to a point on another body.
Local offset from the center of body A to its attachment point.
Local offset from the center of body B to its attachment point.
Spring frequency and damping parameters.
Handles the solve iterations of a bunch of ball socket constraints.
Constrains the relative linear velocity between two bodies to a target.
Conceptually, controls the relative velocity by a virtual lever arm attached to the center of A and leading to the anchor of B.
Offset from body B to its anchor.
Target relative linear velocity between A and B, stored in A's local space. Target world space linear velocity of B is LinearVelocityA + TargetVelocityLocalA * OrientationA.
Motor control parameters.
Handles the solve iterations of a bunch of ball socket motor constraints.
Constrains a point on one body to a point on another body.
Provides speed and force configuration that the BallSocket joint does not.
Local offset from the center of body A to its attachment point.
Local offset from the center of body B to its attachment point.
Spring frequency and damping parameters.
Servo control parameters.
Handles the solve iterations of a bunch of ball socket servo constraints.
Provides shared functionality for constraints with jacobians similar to the BallSocket.
Constrains the center of two bodies to be separated by a goal distance.
Target distance between the body centers.
Spring frequency and damping parameters.
Handles the solve iterations of a bunch of distance servos.
Checks if a value is a finite number- neither infinite nor NaN.
Value to check.
True if the value is neither infinite nor NaN, false otherwise.
Checks if a value is a finite value greater than zero and not NaN.
Value to check.
True if the value is a finite number greater than zero and not NaN, false otherwise.
Checks if a value is a finite value greater than or equal to zero and not NaN.
Value to check.
True if the value is a finite number greater than or equal to zero and not NaN, false otherwise.
Checks if a value is a finite value less than zero and not NaN.
Value to check.
True if the value is a finite number less than zero and not NaN, false otherwise.
Checks if a value is a finite value less than or equal to zero and not NaN.
Value to check.
True if the value is a finite number less than or equal to zero and not NaN, false otherwise.
Handles the solve iterations of a bunch of 1-contact one body manifold constraints.
Handles the solve iterations of a bunch of 2-contact one body manifold constraints.
Handles the solve iterations of a bunch of 3-contact one body manifold constraints.
Handles the solve iterations of a bunch of 4-contact one body manifold constraints.
Handles the solve iterations of a bunch of 1-contact two body manifold constraints.
Handles the solve iterations of a bunch of 2-contact two body manifold constraints.
Handles the solve iterations of a bunch of 3-contact two body manifold constraints.
Handles the solve iterations of a bunch of 4-contact two body manifold constraints.
Handles the solve iterations of a bunch of 2-contact nonconvex two body manifold constraints.
Handles the solve iterations of a bunch of 2-contact nonconvex one body manifold constraints.
Handles the solve iterations of a bunch of 3-contact nonconvex two body manifold constraints.
Handles the solve iterations of a bunch of 3-contact nonconvex one body manifold constraints.
Handles the solve iterations of a bunch of 4-contact nonconvex two body manifold constraints.
Handles the solve iterations of a bunch of 4-contact nonconvex one body manifold constraints.
Callbacks for direct references to the solver's contact constraint data.
Provides a reference to a convex one body contact constraint. Constraint data is in the first lane of the direct reference (slot 0 of vectors).
Type of the prestep data returned.
Type of the accumulated impulses data returned.
Body handle referenced by the constraint.
Prestep data associated with the constraint.
Accumulated impulses associated with the constraint.
Provides a reference to a convex two body contact constraint. Constraint data is in the first lane of the direct reference (slot 0 of vectors).
Type of the prestep data returned.
Type of the accumulated impulses data returned.
First body handle referenced by the constraint.
Second body handle referenced by the constraint.
Prestep data associated with the constraint.
Accumulated impulses associated with the constraint.
Provides a reference to a nonconvex one body contact constraint. Constraint data is in the first lane of the direct reference (slot 0 of vectors).
Type of the prestep data returned.
Type of the accumulated impulses data returned.
Body handle referenced by the constraint.
Prestep data associated with the constraint.
Accumulated impulses associated with the constraint.
Provides a reference to a nonconvex two body contact constraint. Constraint data is in the first lane of the direct reference (slot 0 of vectors).
Type of the prestep data returned.
Type of the accumulated impulses data returned.
First body handle referenced by the constraint.
Second body handle referenced by the constraint.
Prestep data associated with the constraint.
Accumulated impulses associated with the constraint.
Callbacks for direct references to the solver's contact constraint data. Includes only prestep and impulse data.
Provides a reference to a convex one body contact constraint. Constraint data is in the first lane of the direct reference (slot 0 of vectors).
Type of the prestep data returned.
Type of the accumulated impulses data returned.
Prestep data associated with the constraint.
Accumulated impulses associated with the constraint.
Provides a reference to a convex two body contact constraint. Constraint data is in the first lane of the direct reference (slot 0 of vectors).
Type of the prestep data returned.
Type of the accumulated impulses data returned.
Prestep data associated with the constraint.
Accumulated impulses associated with the constraint.
Provides a reference to a nonconvex one body contact constraint. Constraint data is in the first lane of the direct reference (slot 0 of vectors).
Type of the prestep data returned.
Type of the accumulated impulses data returned.
Prestep data associated with the constraint.
Accumulated impulses associated with the constraint.
Provides a reference to a nonconvex two body contact constraint. Constraint data is in the first lane of the direct reference (slot 0 of vectors).
Type of the prestep data returned.
Type of the accumulated impulses data returned.
Prestep data associated with the constraint.
Accumulated impulses associated with the constraint.
Transforms an impulse from constraint space to world space, uses it to modify the cached world space velocities of the bodies.
Transforms an impulse from constraint space to world space, uses it to modify the cached world space velocities of the bodies.
Handles the tangent friction implementation.
Transforms an impulse from constraint space to world space, uses it to modify the cached world space velocities of the bodies.
Handles the tangent friction implementation for one body contact constraints.
Transforms an impulse from constraint space to world space, uses it to modify the cached world space velocities of the bodies.
Handles the tangent friction implementation.
Transforms an impulse from constraint space to world space, uses it to modify the cached world space velocities of the bodies.
Handles the tangent friction implementation.
Transforms an impulse from constraint space to world space, uses it to modify the cached world space velocities of the bodies.
Constrains points on two bodies to be separated by a distance within a range.
Local offset from the center of body A to its attachment point.
Local offset from the center of body B to its attachment point.
Minimum distance permitted between the point on A and the point on B.
Maximum distance permitted between the point on A and the point on B.
Spring frequency and damping parameters.
Creates a distance limit description.
Local offset from the center of body A to its attachment point.
Local offset from the center of body B to its attachment point.
Minimum distance permitted between the point on A and the point on B.
Maximum distance permitted between the point on A and the point on B.
Spring frequency and damping parameters.
Handles the solve iterations of a bunch of distance servos.
Constrains points on two bodies to be separated by a goal distance.
Local offset from the center of body A to its attachment point.
Local offset from the center of body B to its attachment point.
Distance that the constraint will try to reach between the attachment points.
Servo control parameters.
Spring frequency and damping parameters.
Creates a distance servo description.
Local offset from the center of body A to its attachment point.
Local offset from the center of body B to its attachment point.
Distance that the constraint will try to reach between the attachment points.
Spring frequency and damping parameters.
Servo control parameters.
Handles the solve iterations of a bunch of distance servos.
A constraint's body references. Stored separately from the iteration data since it is accessed by both the prestep and solve.
Prestep, warm start and solve iteration functions for a four body constraint type.
Type of the prestep data used by the constraint.
Type of the accumulated impulses used by the constraint.
Type of the projection to input.
Shared implementation across all four body constraints.
Constrains two bodies with a hinge. Equivalent to a BallSocket constraint and an AngularHinge constraint solved together.
Local offset from the center of body A to its attachment point.
Hinge axis in the local space of A.
Local offset from the center of body B to its attachment point.
Hinge axis in the local space of B.
Spring frequency and damping parameters.
Marks a type as a description of a constraint associated with a particular batch.
Note that one batch may have multiple description types associated with it, each one potentially offering a different subset of properties or translation logic.
Type of the description object.
Changes the batch-held memory at a given location to match the given description.
Batch to modify.
Index of the target constraint's bundle.
Index of the target constraint within its bundle.
Creates a description from the batch-held memory at a given location.
Batch to read.
Index of the source constraint's bundle.
Index of the source constraint within its bundle.
Description of the constraint.
Gets the type id of the constraint that this is a description of.
Gets the type of the type batch which contains described constraints.
Marks a type as a one body constraint description.
Type of the description.
This and the other body-count aware interfaces exist to give the compiler a way to report errors when using Solver.Add with different body counts.
Marks a type as a two body constraint description.
Type of the description.
This and the other body-count aware interfaces exist to give the compiler a way to report errors when using Solver.Add with different body counts.
Marks a type as a three body constraint description.
Type of the description.
This and the other body-count aware interfaces exist to give the compiler a way to report errors when using Solver.Add with different body counts.
Marks a type as a four body constraint description.
Type of the description.
This and the other body-count aware interfaces exist to give the compiler a way to report errors when using Solver.Add with different body counts.
Transforms an impulse from constraint space to world space, uses it to modify the cached world space velocities of the bodies.
Constrains points on two bodies to a range of offsets from each other along a direction anchored to body A.
Local offset from the center of body A to its attachment point.
Local offset from the center of body B to its attachment point.
Direction of the motorized axis in the local space of body A.
Minimum offset along the world axis between A and B's anchor points.
Maximum offset along the world axis between A and B's anchor points.
Spring frequency and damping parameters.
Constrains points on two bodies to move relative to each other along a direction.
Local offset from the center of body A to its attachment point.
Local offset from the center of body B to its attachment point.
Direction of the motorized axis in the local space of body A.
Target relative velocity along the world axis between A and B's anchor points.
Motor control parameters.
Constrains points on two bodies to be on a plane defined in the local space of one of the bodies.
Local offset from the center of body A to its attachment point.
Local offset from the center of body B to its attachment point.
Direction of the plane normal in the local space of body A.
Target offset from A's plane anchor to B's anchor along the plane normal.
Servo control parameters.
Spring frequency and damping parameters.
Defines some of the shared behavior across motor constraints.
Maximum amount of force the motor can apply in one unit of time.
Mass-scaled damping constant. If you want to simulate a viscous damping coefficient of D with an object of mass M, set this damping value to D / M.
Gets or sets how soft the constraint is. Values range from 0 to infinity. Softness is inverse damping; 0 is perfectly rigid, 1 is very soft, float.MaxValue is effectively nonexistent.
Checks if a settings instance has valid nonnegative values.
Instance to examine.
True if the settings are valid, false otherwise.
Defines settings for a motor constraint.
Maximum amount of force the motor can apply in one unit of time.
Gets or sets how soft the constraint is. Values range from 0 to infinity. Softness is inverse damping; 0 is perfectly rigid, 1 is very soft, float.MaxValue is effectively nonexistent.
Constrains the angular velocity of one body to the target.
Target angular velocity.
Motor control parameters.
Constrains a single body to a target orientation.
Target orientation of the constraint.
Spring frequency and damping parameters.
Servo control parameters.
Constrains a point on a body to have a target linear velocity.
Offset to the attachment point in the local space of the body.
Target velocity of the attachment point.
Motor control parameters.
Constrains a point on a body to a target location.
Offset to the attachment point in the local space of the body.
Target position.
Spring frequency and damping parameters.
Servo control parameters.
Prestep, warm start and solve iteration functions for a constraint type.
Type of the prestep data used by the constraint.
Type of the accumulated impulses used by the constraint.
Type of the projection to input.
Prestep, warm start, solve iteration, and incremental contact update functions for a one body contact constraint type.
Type of the prestep data used by the constraint.
Type of the accumulated impulses used by the constraint.
Type of the projection to input.
Shared implementation across all one body constraints.
Constrains a point on body B to be on a line attached to body A.
Local offset from the center of body A to its attachment point.
Local offset from the center of body B to its attachment point.
Direction of the line in the local space of body A.
Servo control parameters.
Spring frequency and damping parameters.
Gets settings representing a servo with unlimited force, speed, and no base speed.
Checks servo settings to ensure valid values.
Settings to check.
True if the settings contain valid values, false otherwise.
Computes springiness values for a set of constraints.
Spring settings associated with the constraints.
Duration of the time step.
The multiplier applied to error to get bias velocity.
Scaling factor to apply to the effective mass to get the softened effective mass.
Scaling factor to apply to the accumulated impulse during the solve to soften the target velocity.
Target number of undamped oscillations per unit of time, scaled by 2 * PI.
Twice the ratio of the spring's actual damping to its critical damping.
Gets or sets the target number of undamped oscillations per unit of time.
Gets or sets the ratio of the spring's actual damping to its critical damping. 0 is undamped, 1 is critically damped, and higher values are overdamped.
Checks if a spring settings instance contains valid values.
Settings to check.
True if the spring settings are valid, false otherwise.
Constructs a new spring settings instance.
Target number of undamped oscillations per unit of time.
Ratio of the spring's actual damping to its critical damping. 0 is undamped, 1 is critically damped, and higher values are overdamped.
Restricts axes attached to two bodies to fall within a maximum swing angle.
Axis attached to body A in its local space.
Axis attached to body B in its local space.
Minimum dot product between the world space A and B axes that the constraint attempts to maintain.
Spring frequency and damping parameters.
Gets or sets the maximum swing angle that the constraint allows between world axis A and B. Based on the MinimumDot field.
Constrains two bodies with a swivel hinge that allows rotation around two axes, like a laptop monitor hinge that allows flipping the screen. Equivalent to a BallSocket constraint and an AngularSwivelHinge constraint solved together.
Local offset from the center of body A to its attachment point.
Swivel axis in the local space of body A.
Local offset from the center of body B to its attachment point.
Hinge axis in the local space of body B.
Spring frequency and damping parameters.
A constraint's body references. Stored separately from the iteration data since it is accessed by both the prestep and solve.
Prestep, warm start and solve iteration functions for a three body constraint type.
Type of the prestep data used by the constraint.
Type of the accumulated impulses used by the constraint.
Type of the projection to input.
Shared implementation across all four body constraints.
Constrains two bodies' rotations around attached twist axes to a range of permitted twist angles.
Local space basis attached to body A against which to measure body B's transformed axis. Expressed as a 3x3 rotation matrix, the X axis corresponds with 0 degrees,
the Y axis corresponds to 90 degrees, and the Z axis is the twist axis.
Local space basis attached to body B that will be measured against body A's basis.
Expressed as a 3x3 rotation matrix, the transformed X axis will be measured against A's X and Y axes. The Z axis is the twist axis.
Minimum angle between B's axis to measure and A's measurement axis.
Maximum angle between B's axis to measure and A's measurement axis.
Spring frequency and damping parameters.
Constrains the twist velocity between two bodies to a target.
Local twist axis attached to body A.
Local twist axis attached to body B.
Goal relative twist velocity around the body axes.
Motor control parameters.
Constrains two bodies to maintain a target twist angle around body-attached axes.
Local space basis attached to body A against which to measure body B's transformed axis. Expressed as a 3x3 rotation matrix, the X axis corresponds with 0 degrees,
the Y axis corresponds to 90 degrees, and the -Z axis is the twist axis. When viewed along the twist axis, positive change in angle causes counterclockwise rotation in right handed coordinates.
Local space basis attached to body B that will be measured against body A's basis.
Expressed as a 3x3 rotation matrix, the transformed X axis will be measured against A's X and Y axes. The Z axis is the twist axis.
Target angle between B's axis to measure and A's measurement axis.
Spring frequency and damping parameters.
Servo control parameters.
A constraint's body references. Stored separately from the iteration data since it is accessed by both the prestep and solve.
Two address streams isn't much of a problem for prefetching.
Prestep, warm start and solve iteration functions for a two body constraint type.
Type of the prestep data used by the constraint.
Type of the accumulated impulses used by the constraint.
Type of the projection to input.
Prestep, warm start, solve iteration, and incremental contact update functions for a two body contact constraint type.
Type of the prestep data used by the constraint.
Type of the accumulated impulses used by the constraint.
Type of the projection to input.
Shared implementation across all two body constraints.
Stores the raw AOSOA formatted data associated with constraints in a type batch.
Superclass of constraint type batch processors. Responsible for interpreting raw type batches for the purposes of bookkeeping and solving.
This class holds no actual state of its own. A solver creates a unique type processor for each registered constraint type, and all instances are held in untyped memory.
Splitting the functionality from the data allows for far fewer GC-tracked instances and allows the raw data layout to be shared more easily.
For example, sleeping simulation islands store type batches, but they are created and used differently- and for convenience, they are stored on a per-island basis.
Using the same system but with reference type TypeBatches, tens of thousands of inactive islands would imply tens of thousands of GC-tracked objects.
That's not acceptable, so here we are.
Conceptually, you can think of the solver's array of TypeProcessors like C function pointers.
Gets the number of bodies associated with each constraint in this type processor.
Gets the number of degrees of freedom that each constraint in this type processor constrains. Equal to the number of entries in the accumulated impulses.
Allocates a slot in the batch.
Type batch to allocate in.
Handle of the constraint to allocate. Establishes a link from the allocated constraint to its handle.
Pointer to a list of body indices (not handles!) with count equal to the type batch's expected number of involved bodies.
Allocation provider to use if the type batch has to be resized.
Index of the slot in the batch.
Moves a constraint from one ConstraintBatch's TypeBatch to another ConstraintBatch's TypeBatch of the same type.
Index of the batch that owns the type batch that is the source of the constraint transfer.
Index of the constraint to move in the current type batch.
Solver that owns the batches.
Bodies set that owns all the constraint's bodies.
Index of the ConstraintBatch in the solver to copy the constraint into.
Defines a function that creates a sort key from body references in a type batch. Used by constraint layout optimization.
Overwrites all the data in the target constraint slot with source data.
Removes a constraint from the batch.
Index of the constraint to remove.
The handle to constraint mapping used by the solver that could be modified by a swap on removal.
Moves a constraint from one ConstraintBatch's TypeBatch to another ConstraintBatch's TypeBatch of the same type.
Index of the batch that owns the type batch that is the source of the constraint transfer.
Index of the constraint to move in the current type batch.
Solver that owns the batches.
Bodies set that owns all the constraint's bodies.
Index of the ConstraintBatch in the solver to copy the constraint into.
Constrains the volume of a tetrahedron connecting the centers of four bodies to match a goal volume.
Scaled volume computed from (ab x ac) * ad; the volume may be negative depending on the winding of the tetrahedron.
6 times the target volume of the tetrahedra. Computed from (ab x ac) * ad; this may be negative depending on the winding of the tetrahedron.
Spring frequency and damping parameters.
Creates a new volume constraint, initializing the target volume using a set of initial positions.
Initial position of the first body.
Initial position of the second body.
Initial position of the third body.
Initial position of the fourth body.
Spring settings to apply to the volume constraint.
Handles the solve iterations of a bunch of volume constraints.
Constrains two bodies to maintain a relative position and orientation. All six degrees of freedom are solved simultaneously.
Offset from body A to body B in the local space of A.
Target orientation of body B in body A's local space.
Springiness of the position and orientation constraints.
Handles the solve iterations of a bunch of ball socket constraints.
Helper class to register the default types within a simulation instance.
Registers the set of constraints that are packaged in the engine.
Creates a task registry containing the default collision pair types.
Creates a task registry containing the default sweep task types.
Contains constraints that could not belong to any lower constraint batch due to their involved bodies. All of the contained constraints will be solved using a fallback solver that
trades rigidity for parallelism.
Gets the number of bodies in the fallback batch.
Unique identifier of a body belonging to a simulation's Bodies collection.
Index in the handle-to-memory mapping table used to look up the current memory location of the body.
This value will not (and must not) change during the body's lifespan, but the memory that the table points to could change.
Unique identifier of a static belonging to a simulation's Statics collection.
Index in the handle-to-memory mapping table used to look up the current memory location of the body.
This value will not (and must not) change during the body's lifespan, but the memory that the table points to could change.
Unique identifier of a constraint belonging to a simulation's Solver.
Index in the handle-to-memory mapping table used to look up the current memory location of the constraint.
This value will not (and must not) change during the constraint's lifespan, but the memory that the table points to could change.
Collects body handles associated with an active constraint as integers.
Shared miscellaneous helper functions.
Provides functionality for efficiently waking up sleeping bodies.
Wakes up a body if it is sleeping. All bodies that can be found by traversing the constraint graph from the body will also be awakened.
If the body is already awake, this does nothing.
Handle of the body to awaken.
Wakes up any sleeping bodies associated with a constraint. All bodies that can be found by traversing the constraint graph from the constraint referenced bodies will also be awakened.
If all bodies associated with the constraint are already awake, this does nothing.
Handle of the constraint to awaken.
Wakes up all bodies and constraints within a set. Doesn't do anything if the set is awake (index zero).
Index of the set to awaken.
Awakens a list of set indices.
List of set indices to wake up.
Thread dispatcher to use when waking the bodies. Pass null to run on a single thread.
Represents the constraint batch structure and all references in an island. Holds everything necessary to create and gather a full island.
Gets or sets the multiplier applied to the active body count used to calculate the number of sleep traversals in a given timestep.
Gets or sets the fraction of the active set to target as the number of bodies slept in a given frame.
This is only a goal; the actual number of slept bodies may be more or less.
Gets or sets the fraction of the active set to target as the number of bodies traversed for sleeping in a given frame.
This is only a goal; the actual number of traversed bodies may be more or less.
Traverses the active constraint graph collecting bodies that match a predicate. If any body visited during the traversal fails to match the predicate, the traversal terminates.
Type of the predicate to test each body index with.
Pool to allocate temporary collections from.
Index of the active body to start the traversal at.
Predicate to test each traversed body with. If any body results in the predicate returning false, the traversal stops and the function returns false.
List to fill with body indices traversed during island collection. Bodies failing the predicate will not be included.
List to fill with constraint handles traversed during island collection.
True if the simulation graph was traversed without ever finding a body that made the predicate return false. False if any body failed the predicate.
The bodyIndices and constraintHandles lists will contain all traversed predicate-passing bodies and constraints.
If true, this job relates to a subset of body indices. If false, this job relates to a subset of constraint handles.
Forcefully sleeps a list of bodies and all bodies that can be reached by traversing the constraint graph from those bodies.
List of body indices to sleep.
Thread dispatcher to use for the sleep attempt, if any. If null, sleep is performed on the calling thread.
True if the sleep should produce deterministic results at higher cost, false otherwise.
Forces a body and all bodies that can be found by traversing the constraint graph from that body to go to sleep.
Index of the body to sleep in the active set.
Ensures that the Bodies, Solver, and NarrowPhase can hold at least the given number of sets (BodySets for the Bodies collection, ConstraintSets for the Solver, PairSubcaches for the NarrowPhase.PairCache).
Number of sets to guarantee space for.
Ensures that the Bodies and Solver can hold the given number of sets.
If the existing allocation is smaller than the requested sets capacity, the allocation will be enlarged.
If the existing allocation is larger than both the existing potentially allocated set range and the requested sets capacity, the allocation will be shrunk.
Shrinks will never cause an existing set to be lost.
Target number of sets to allocate space for.
Delegate used by ITimesteppers for their stage callbacks.
Time step duration.
Thread dispatcher used for this timestep.
Delegate used by ITimesteppers for stage callbacks within substepping loops.
Index of the substep executing this stage.
Time step duration.
Thread dispatcher used for this timestep.
Defines a type capable of updating the simulation state for a given elapsed time.
Callbacks to execute immediately before collision detection executes.
Callbacks to execute after collision detection completes.
Performs one timestep of the given length.
Duration of the time step.
Thread dispatcher to use for execution, if any.
Defines how a pose integrator should handle angular velocity integration.
Angular velocity is directly integrated and does not change as the body pose changes. Does not conserve angular momentum.
Approximately conserves angular momentum by updating the angular velocity according to the change in orientation. Does a decent job for gyroscopes, but angular velocities will tend to drift towards a minimal inertia axis.
Approximately conserves angular momentum by including an implicit gyroscopic torque. Best option for Dzhanibekov effect simulation, but applies a damping effect that can make gyroscopes less useful.
Defines a type that handles callbacks for body pose integration.
Gets how the pose integrator should handle angular velocity integration.
Performs any required initialization logic after the Simulation instance has been constructed.
Simulation that owns these callbacks.
Called prior to integrating the simulation's active bodies. When used with a substepping timestepper, this could be called multiple times per frame with different time step values.
Current time step duration.
Callback called for each active body within the simulation during body integration.
Index of the body being visited.
Body's current pose.
Body's current local inertia.
Index of the worker thread processing this body.
Reference to the body's current velocity to integrate.
Provides helper functions for integrating body poses.
Integrates the velocity of mobile bodies over time into changes in position and orientation. Also applies gravitational acceleration to dynamic bodies.
This variant of the integrator uses a single global gravity. Other integrators that provide per-entity gravity could exist later.
This integrator also assumes that the bodies positions are stored in terms of single precision floats. Later on, we will likely modify the Bodies
storage to allow different representations for larger simulations. That will require changes in this integrator, the relative position calculation of collision detection,
the bounding box calculation, and potentially even in the broadphase in extreme cases (64 bit per component positions).
Updates the simulation in the order of: sleeper -> integrate body poses, velocity and bounding boxes -> collision detection -> solver -> data structure optimization.
Fires after the sleeper completes and before bodies are integrated.
Fires after bodies have had their position, velocity, and bounding boxes updated, but before collision detection begins.
Fires after all collisions have been identified, but before constraints are solved.
Fires after the solver executes and before data structures are incrementally optimized.
Updates the simulation in the order of: sleeper -> integrate velocities and update body bounding boxes -> collision detection -> solver -> integrate body poses -> data structure optimization.
Fires after the sleeper completes and before bodies are integrated.
Fires after bodies have had their velocities and bounding boxes updated, but before collision detection begins.
Fires after all collisions have been identified, but before constraints are solved.
Fires after the solver executes and before body poses are integrated.
Fires after bodies have their poses integrated and before data structures are incrementally optimized.
Orchestrates the bookkeeping and execution of a full dynamic simulation.
Gets the simulation profiler. Note that the SimulationProfiler implementation only exists when the library is compiled with the PROFILE compilation symbol; if not defined, returned times are undefined.
Gets the main memory pool used to fill persistent structures and main thread ephemeral resources across the engine.
Gets the timestepper used to update the simulation state.
Gets or sets whether to use a deterministic time step when using multithreading. When set to true, additional time is spent sorting constraint additions and transfers.
Note that this can only affect determinism locally- different processor architectures may implement instructions differently.
Constructs a simulation supporting dynamic movement and constraints with the specified narrow phase callbacks.
Buffer pool used to fill persistent structures and main thread ephemeral resources across the engine.
Callbacks to use in the narrow phase.
Callbacks to use in the pose integrator.
Timestepper that defines how the simulation state should be updated.
Number of iterations the solver should use.
Number of synchronized batches the solver should maintain before falling back to a lower quality jacobi hybrid solver.
Allocation sizes to initialize the simulation with. If left null, default values are chosen.
New simulation.
Executes the sleep stage, moving candidate
Thread dispatcher to use for the sleeper execution, if any.
Updates the position, velocity, world inertia, deactivation candidacy and bounding boxes of active bodies.
Duration of the time step.
Thread dispatcher to use for execution, if any.
Predicts the bounding boxes of active bodies by speculatively integrating velocity. Does not actually modify body velocities. Updates deactivation candidacy.
Duration of the time step.
Thread dispatcher to use for execution, if any.
Updates the velocities, world space inertias, bounding boxes, and deactivation candidacy of active bodies.
Duration of the time step.
Thread dispatcher to use for execution, if any.
Updates the velocities and world space inertias of active bodies.
Duration of the time step.
Thread dispatcher to use for execution, if any.
Updates the poses of active bodies.
Duration of the time step.
Thread dispatcher to use for execution, if any.
Updates the broad phase structure for the current body bounding boxes, finds potentially colliding pairs, and then executes the narrow phase for all such pairs. Generates contact constraints for the solver.
Duration of the time step.
Thread dispatcher to use for execution, if any.
Uses the current body velocities to incrementally update all active contact constraint penetration depths.
Duration of the time step.
Thread dispatcher to use for execution, if any.
Solves all active constraints in the simulation.
Duration of the time step.
Thread dispatcher to use for execution, if any.
Incrementally improves body and constraint storage for better performance.
Thread dispatcher to use for execution, if any.
Performs one timestep of the given length.
Be wary of variable timesteps. They can harm stability. Whenever possible, keep the timestep the same across multiple frames unless you have a specific reason not to.
Duration of the time step.
Thread dispatcher to use for execution, if any.
Clears the simulation of every object, only returning memory to the pool that would be returned by sequential removes.
Other persistent allocations, like those in the Bodies set, will remain.
Increases the allocation size of any buffers too small to hold the allocation target.
The final size of the allocated buffers are constrained by the allocator. It is not guaranteed to be exactly equal to the target, but it is guaranteed to be at least as large.
This is primarily a convenience function. Everything it does internally can be done externally.
For example, if only type batches need to be resized, the solver's own functions can be used directly.
Allocation sizes to guarantee sufficient size for.
Increases the allocation size of any buffers too small to hold the allocation target, and decreases the allocation size of any buffers that are unnecessarily large.
The final size of the allocated buffers are constrained by the allocator. It is not guaranteed to be exactly equal to the target, but it is guaranteed to be at least as large.
This is primarily a convenience function. Everything it does internally can be done externally.
For example, if only type batches need to be resized, the solver's own functions can be used directly.
Allocation sizes to guarantee sufficient size for.
Clears the simulation of every object and returns all pooled memory to the buffer pool. Leaves the simulation in an unusable state.
Intersects a ray against the simulation.
Type of the callbacks to execute on ray-object intersections.
Origin of the ray to cast.
Direction of the ray to cast.
Maximum length of the ray traversal in units of the direction's length.
callbacks to execute on ray-object intersections.
User specified id of the ray.
Sweeps a shape against the simulation.
Type of the shape to sweep.
Type of the callbacks executed when a sweep impacts an object in the scene.
Shape to sweep.
Starting pose of the sweep.
Velocity of the swept shape.
Maximum length of the sweep in units of time used to integrate the velocity.
Pool to allocate any temporary resources in during execution.
Callbacks executed when a sweep impacts an object in the scene.
Simulation objects are treated as stationary during the sweep.
Minimum amount of progress in terms of t parameter that any iterative sweep tests should make for each sample.
Threshold in terms of t parameter under which iterative sweep tests are permitted to exit in collision.
Maximum number of iterations to use in iterative sweep tests.
Sweeps a shape against the simulation.
Type of the shape to sweep.
Type of the callbacks executed when a sweep impacts an object in the scene.
Shape to sweep.
Starting pose of the sweep.
Velocity of the swept shape.
Maximum length of the sweep in units of time used to integrate the velocity.
Pool to allocate any temporary resources in during execution.
Callbacks executed when a sweep impacts an object in the scene.
Simulation objects are treated as stationary during the sweep.
The common set of allocation sizes for a simulation.
The number of bodies to allocate space for.
The number of statics to allocate space for.
The number of inactive islands to allocate space for.
Minimum number of shapes to allocate space for in each shape type batch.
The number of constraints to allocate bookkeeping space for. This does not affect actual type batch allocation sizes, only the solver-level constraint handle storage.
The minimum number of constraints to allocate space for in each individual type batch.
New type batches will be given enough memory for this number of constraints, and any compaction will not reduce the allocations below it.
The number of constraints can vary greatly across types- there are usually far more contacts than ragdoll constraints.
Per type estimates can be assigned within the Solver.TypeBatchAllocation if necessary. This value acts as a lower bound for all types.
The minimum number of constraints to allocate space for in each body's constraint list.
New bodies will be given enough memory for this number of constraints, and any compaction will not reduce the allocations below it.
Stores profiling information for the previous simulation execution.
Gets the time it took to complete the last execution of the given stage. If no stage matching the given object ran, returns -1.
Stage to look up the time for.
Time it took to complete the last execution of the given stage.
Checks whether the child of a collidable should be tested against a ray. Only called by shape types that can have more than one child.
Index of the candidate in the parent collidable.
True if the child should be tested by the ray, false otherwise.
Called when a ray impact has been found.
Information about the ray associated with this hit.
Maximum distance along the ray that the traversal is allowed to go in units of ray direction length. Can be set to limit future tests.
Distance along the ray to the impact in units of ray direction length. In other words, hitLocation = ray.Origin + ray.Direction * t.
Surface normal at the hit location.
Index of the hit child. For convex shapes or other types that don't have multiple children, this is always zero.
Defines a type capable of filtering ray test candidates and handling ray hit results.
Checks whether a collidable identified by the acceleration structure should be tested against a ray.
Candidate collidable for ray testing.
True if the collidable should be tested by the ray, false otherwise.
Checks whether the child of a collidable should be tested against a ray. Only called by shape types that can have more than one child.
Parent of the candidate.
Index of the candidate in the parent collidable.
True if the child should be tested by the ray, false otherwise.
Called when a ray impact has been found.
Information about the ray associated with this hit.
Maximum distance along the ray that the traversal is allowed to go in units of ray direction length. Can be set to limit future tests.
Distance along the ray to the impact in units of ray direction length. In other words, hitLocation = ray.Origin + ray.Direction * t.
Surface normal at the hit location.
Collidable hit by the ray.
Index of the hit child. For convex shapes or other types that don't have multiple children, this is always zero.
Defines a type capable of filtering sweep candidates and handling sweep results.
Checks whether to run a detailed sweep test against a target collidable.
Collidable to check.
True if the sweep test should be attempted, false otherwise.
Checks whether to run a detailed sweep test against a target collidable's child.
Collidable to check.
Index of the child in the collidable to check.
True if the sweep test should be attempted, false otherwise.
Called when a sweep test detects a hit with nonzero T value.
Reference to maximumT passed to the traversal.
Time of impact for the sweep test.
Location of the first hit detected by the sweep.
Surface normal at the hit location.
Collidable hit by the traversal.
Called when a sweep test detects a hit at T = 0, meaning that no location or normal can be computed.
Reference to maximumT passed to the traversal.
Collidable hit by the traversal.
Buffer containing all constraint sets. The first slot is dedicated to the active set; subsequent slots may be occupied by the constraints associated with inactive islands.
Gets a reference to the active set of constraints, stored in the first set slot.
Pool to retrieve constraint handles from when creating new constraints.
Gets the maximum number of solver batches to allow before resorting to a fallback solver.
If a single body is constrained by more than FallbackBatchThreshold constraints, all constraints beyond FallbackBatchThreshold are placed into a fallback batch.
The fallback batch uses a different solver that can handle multiple constraints affecting a single body in a single batch, allowing greater parallelism at the cost of convergence speed.
Gets or sets the number of solver iterations to compute per call to Update.
Gets or sets the minimum amount of space, in constraints, initially allocated in any new type batch.
Sets the minimum capacity initially allocated to a new type batch of the given type.
Id of the constraint type to check the initial capacity of.
Minimum capacity to use for the type.
Gets the minimum initial capacity for a given type.
The returned value is the larger of MinimumCapacityPerTypeBatch and the value set by SetMinimumCapacityForType for the given type id.
Type id to retrieve the minm
Larger of MinimumCapacityPerTypeBatch and the given type's minimum set by SetMinimumCapacityForType.
Resets all per-type initial capacities to zero. Leaves the minimum capacity across all constraints unchanged.
Gets the total number of constraints across all sets, batches, and types. Requires enumerating
all type batches; this can be expensive.
Gets whether the given constraint handle refers to a constraint in the solver.
Constraint handle to check for existence in the solver.
True if the constraint handle exists in the solver, false otherwise.
Gets a direct reference to the constraint associated with a handle.
The reference is temporary; any constraint removals that affect the referenced type batch may invalidate the index.
Type of the type batch being referred to.
Handle index of the constraint.
Temporary direct reference to the type batch and index in the type batch associated with the constraint handle.
May be invalidated by constraint removals.
Attempts to locate a spot for a new constraint. Does not perform allocation for the constraint. If no batch exists, returns the index just beyond the end of the existing list of batches.
Index of the batch that the constraint would fit in.
This is used by the narrowphase's multithreaded constraint adders to locate a spot for a new constraint without requiring a lock. Only after a candidate is located
do those systems attempt an actual claim, limiting the duration of locks and increasing potential parallelism.
Applies a description to a constraint slot without waking up the associated island.
Type of the description to apply.
Reference of the constraint being updated.
Description to apply to the slot.
Applies a description to a constraint slot without waking up the associated island.
Type of the description to apply.
Handle of the constraint being updated.
Description to apply to the slot.
Applies a description to a constraint slot without waking up the associated island.
Type of the description to apply.
Handle of the constraint being updated.
Description to apply to the slot.
Applies a description to a constraint slot, waking up the connected bodies if necessary.
Type of the description to apply.
Handle of the constraint being updated.
Description to apply to the slot.
Applies a description to a constraint slot, waking up the connected bodies if necessary.
Type of the description to apply.
Handle of the constraint being updated.
Description to apply to the slot.
Allocates a constraint slot and sets up a constraint with the specified description.
Type of the constraint description to add.
Body handles used by the constraint.
Allocated constraint handle.
Allocates a constraint slot and sets up a constraint with the specified description.
Type of the constraint description to add.
Body handles referenced by the constraint.
Allocated constraint handle.
Allocates a one-body constraint slot and sets up a constraint with the specified description.
Type of the constraint description to add.
Body connected to the constraint.
Allocated constraint handle.
Allocates a one-body constraint slot and sets up a constraint with the specified description.
Type of the constraint description to add.
First body of the constraint.
Allocated constraint handle.
Allocates a two-body constraint slot and sets up a constraint with the specified description.
Type of the constraint description to add.
First body of the constraint.
Second body of the constraint.
Allocated constraint handle.
Allocates a two-body constraint slot and sets up a constraint with the specified description.
Type of the constraint description to add.
First body of the constraint.
Second body of the constraint.
Allocated constraint handle.
Allocates a three-body constraint slot and sets up a constraint with the specified description.
Type of the constraint description to add.
First body of the constraint.
Second body of the constraint.
Third body of the constraint.
Allocated constraint handle.
Allocates a three-body constraint slot and sets up a constraint with the specified description.
Type of the constraint description to add.
First body of the constraint.
Second body of the constraint.
Third body of the constraint.
Allocated constraint handle.
Allocates a four-body constraint slot and sets up a constraint with the specified description.
Type of the constraint description to add.
First body of the constraint.
Second body of the constraint.
Third body of the constraint.
Fourth body of the constraint.
Allocated constraint handle.
Allocates a four-body constraint slot and sets up a constraint with the specified description.
Type of the constraint description to add.
First body of the constraint.
Second body of the constraint.
Third body of the constraint.
Fourth body of the constraint.
Allocated constraint handle.
Removes a constraint from a batch, performing any necessary batch cleanup, but does not return the constraint's handle to the pool.
Handle of the constraint being removed.
Index of the batch to remove from.
Type id of the constraint to remove.
Index of the constraint to remove within its type batch.
Removes the constraint associated with the given handle. Note that this may invalidate any outstanding direct constraint references
by reordering the constraints within the TypeBatch subject to removal.
Handle of the constraint to remove from the solver.
Changes the body references of all constraints associated with a body in response to its movement into a new slot.
Constraints associated with the body now at its old slot, if any, are left untouched.
Memory index that the moved body used to inhabit.
Memory index that the moved body now inhabits.
Changes the body references of all constraints associated with two bodies in response to them swapping slots in memory.
First swapped body index.
Second swapped body index.
Scales the accumulated impulses associated with a constraint set by a given scale.
Set to scale.
Scale to apply to accumulated impulses.
Scales all accumulated impulses in the active set.
Scale to apply to accumulated impulses.
Scales all accumulated impulses in all constraint sets.
Scale to apply to accumulated impulses.
Enumerates the accumulated impulses associated with a constraint.
Constraint to enumerate.
Enumerator to use.
Gathers the squared magnitude of the accumulated impulse for a given constraint.
Constraint to look up the accumulated impulses of.
Squared magnitude of the accumulated impulses associated with the given constraint.
Gathers the magnitude of the accumulated impulse for a given constraint.
Constraint to look up the accumulated impulses of.
Magnitude of the accumulated impulses associated with the given constraint.
Enumerates the set of bodies associated with a constraint in order of their references within the constraint.
Constraint to enumerate.
Enumerator to use.
Removes all objects from the solver. This is meant as a fast path to empty a simulation's constraints. It makes no attempt to retain synchronization with other systems
which may depend on the existence of constraints, like the per-body constraint lists.
Adjusts the size of the the solvers non-typebatch data structures. An allocation will grow if the given capacity exceeds the currently allocated capacity.
Size of the span of body handles to allocate space for. Applies to batch referenced handle sets.
Number of constraint handles to allocate space for. Applies to the handle->constraint mapping table.
Adjusts the size of the the solvers non-typebatch data structures. An allocation is allowed to shrink if it fits both all existing entries and the given capacity.
An allocation will grow if the given capacity exceeds the currently allocated capacity.
Size of the span of body handles to allocate space for. Applies to batch referenced handle sets.
Number of constraint handles to allocate space for. Applies to the handle->constraint mapping table.
Ensures all existing active type batches meet or exceed the current solver-defined minimum capacities. Type batches with capacities smaller than the minimums will be enlarged.
Applies the current solver-defined minimum capacities to existing type batches. Type batches with capacities larger than the minimums and counts less than the minimums may be shrunk.
Type batches with capacities smaller than the minimums will be enlarged.
Returns all pool-retrieved resources to the pool.
The solver cannot be 'rehydrated' for reuse after a disposal. If you want to return bulk data to the pool while leaving the solver in a usable state, consider using Clear instead.
Index of the first bundle in the block.
Exlusive end index of the bundle. Index of the last bundle in the block is End - 1.
Inclusive start of blocks known to be claimed by any worker.
Exclusive end of blocks known to be claimed by any worker.
Behaves like a framework SpinWait, but never voluntarily relinquishes the timeslice to off-core threads.
There are three big reasons for using this over the regular framework SpinWait:
1) The framework spinwait relies on spins for quite a while before resorting to any form of timeslice surrender.
Empirically, this is not ideal for the solver- if the sync condition isn't met within several nanoseconds, it will tend to be some microseconds away.
This spinwait is much more aggressive about moving to yields.
2) After a number of yields, the framework SpinWait will resort to calling Sleep.
This widens the potential set of schedulable threads to those not native to the current core. If we permit that transition, it is likely to evict cached solver data.
(For very large simulations, the use of Sleep(0) isn't that concerning- every iteration can be large enough to evict all of cache-
but there still isn't much benefit to using it over yields in context.)
3) After a particularly long wait, the framework SpinWait resorts to Sleep(1). This is catastrophic for the solver- worse than merely interfering with cached data,
it also simply prevents the thread from being rescheduled for an extremely long period of time (potentially most of a frame!) under the default clock resolution.
Note that this isn't an indication that the framework SpinWait should be changed, but rather that the solver's requirements are extremely specific and don't match
a general purpose solution very well.
Describes the properties of a static object. When added to a simulation, static objects can collide but have no velocity and will not move in response to forces.
Position and orientation of the static.
Collidable properties of the static.
Builds a new static description.
Position of the static.
Orientation of the static.
Collidable description for the static.
Builds a new static description.
Position of the static.
Collidable description for the static.
Builds a new static description with discrete continuity.
Position of the static.
Orientation of the static.
Index of the static's shape in the simulation shapes set.
Distance beyond the surface of the static to allow speculative contacts to be generated.
Builds a new static description with discrete continuity.
Position of the static.
Index of the static's shape in the simulation shapes set.
Distance beyond the surface of the body to allow speculative contacts to be generated.
Convenience structure for directly referring to a static's properties.
Note that this type makes no attempt to protect against unsafe modification of static properties.
Handle of the static that this reference refers to.
The collection containing the static.
Constructs a new static reference.
Handle of the static to refer to.
Collection containing the static.
Gets whether the static reference exists within the static set. True if the handle maps to a valid memory location that agrees that the handle points to it, false otherwise.
Gets a the static's index in the statics collection.
Gets a reference to the static's pose.
Gets a reference to the static's collidable.
Gets a description of the static.
Description of the static.
Sets a static's properties according to a description.
Description of the static.
Changes the shape of a static.
Index of the new shape to use for the static.
Gets a copy of the static's bounding box.
Gets direct pointers to the static's bounding box minimum and maximum in the broad phase. Outputs null if the static has no shape.
Pointer to the bounding box minimum in the broad phase.
Pointer to the bounding box maximum in the broad phase.
Updates the static's bounds in the broad phase for its current state. Does not include velocity expansion. Does nothing if the static has no shape.
Can be useful if you made modifications to the static's state that you want reflected in the broad phase before the next timestep.
For example, if you want to perform ray casts against the broad phase after moving objects around directly, their bounds must be updated or else the broad phase bounds will be out of date and the ray will likely miss.
Collection of allocated static collidables.
Remaps a static handle integer value to the actual array index of the static.
The backing array index may change in response to cache optimization.
Remaps a static index to its handle.
The set of collidables owned by each static. Speculative margins, continuity settings, and shape indices can be changed directly.
Shape indices cannot transition between pointing at a shape and pointing at nothing or vice versa without notifying the broad phase of the collidable addition or removal.
Checks whether a static handle is currently registered with the statics set.
Handle to check for.
True if the handle exists in the collection, false otherwise.
Removes a static from the set by index. Any inactive bodies with bounding boxes overlapping the removed static's bounding box will be forced active.
Index of the static to remove.
Removes a static from the set. Any inactive bodies with bounding boxes overlapping the removed static's bounding box will be forced active.
Handle of the static to remove.
Updates the bounds held within the broad phase for the static's current state.
Adds a new static body to the simulation. All inactive bodies whose bounding boxes overlap the new static are forced active.
Description of the static to add.
Handle of the new static.
Changes the shape of a static and updates its bounds in the broad phase.
Handle of the static to change the shape of.
Index of the new shape to use for the static.
Applies a new description to an existing static object. All inactive bodies with bounding boxes overlapping the old or new static collidable are forced active.
Updates the bounds of the static in the broad phase.
Handle of the static to apply the description to.
Description to apply to the static.
Gets the current description of the static referred to by a given handle.
Handle of the static to look up the description of.
Gathered description of the handle-referenced static.
Gets a reference to a static by its handle.
Handle of the static to grab a reference of.
Reference to the desired static.
Clears all bodies from the set without returning any memory to the pool.
Resizes the allocated spans for static data. Note that this is conservative; it will never orphan existing objects.
Target static data capacity.
Increases the size of buffers if needed to hold the target capacity.
Target data capacity.
Returns all static resources to the pool used to create them.
The object can be reused if it is reinitialized by using EnsureCapacity or Resize.
Updates the simulation in the order of: sleeper -> predict body bounding boxes -> collision detection -> LOOP { contact data update (if on iteration > 0) -> integrate body velocities -> solver -> integrate body poses } -> data structure optimization.
Each inner loop execution simulates a sub-timestep of length dt/substepCount.
Useful for simulations with difficult to solve constraint systems that need shorter timestep durations but which don't require high frequency collision detection.
Gets or sets the number of substeps to execute during each timestep.
Fires after the sleeper completes and before bodies are integrated.
Fires after bodies have their bounding boxes updated for the frame's predicted motion and before collision detection.
Fires after all collisions have been identified, but before the substep loop begins.
Fires at the beginning of a substep.
Fires after contact constraints are incrementally updated at the beginning of substeps after the first and before velocities are integrated.
Fires after bodies have their velocities integrated and before the solver executes.
Fires after the solver executes and before body poses are integrated.
Fires after bodies have their poses integrated and before the substep ends.
Fires at the end of a substep.
Fires after all substeps are finished executing and before data structures are incrementally optimized.
Pointer to a leaf's tree location.
The identity of a leaf is implicit in its position within the leaf array.
Gets the index of the node that the leaf is directly held by.
Gets which child within the owning node the leaf is in.
2-wide tree node.
Metadata associated with a 2-child tree node.
Cached change in cost of the tree starting at this node since the previous frame.
The local cost change is unioned with the refine flags. They're never used simultaneously.
This will be overwritten right after use, so don't expect anything meaningful here outside of refinement scheduling's scope.
Ray representation designed for quicker intersection against axis aligned bounding boxes.
Gets the number of rays in the batch.
Gets pointers to the data for a ray.
Index of the ray to grab.
Pointer to the ray's origin and direction. Note that changing the ray's origin and direction mid-traversal will not change the path of the traversal,
but it will be visible by any future leafs impacted by this ray.
Pointer to the maximum length of the ray in units of the ray's length.
Decreasing this value will prevent the traversal from visiting more distant nodes later in the traversal.
Gets a reference to the data for a ray.
Index of the ray to grab.
Returns a reference to the ray in the ray source.
Reusable structure for testing large numbers of rays against trees.
Constructs a ray batcher and initializes its backing resources.
Pool to pull resources from.
Maximum number of rays to execute in each traversal.
This should typically be chosen as the highest value which avoids spilling data out of L2 cache.
Tree depth to preallocate ray stack space for. If a traversal finds nodes deeper than this, a dynamic resize will be triggered.
Ray representation designed for quicker intersection against axis aligned bounding boxes.
Tests any batched rays against the given tree.
Tree to test the accumulated rays against.
Adds a ray to the batcher. Returns true if the batcher has reached maximum ray capacity and needs to be reset in order to continue adding rays.
Origin of the ray to test against the tree.
Direction of the ray to test against the tree.
Maximum distance that the ray will travel in units of the ray's length.
Identifier value for the ray. Leaf tests will have access to the id.
True if the batcher is full and requires a call to ResetRays before adding any more rays, false otherwise.
Resets the accumulated ray count to zero.
Disposes all the resources backing the ray batcher.
Constructs an empty tree.
Initial number of leaves to allocate room for.
Loads a tree from a byte buffer created by the Serialize function.
Data to load into the tree.
Pool to use to create the tree.
Gets the number of bytes required to store the tree.
Tree to measure.
Number of bytes required to store the tree.
Writes a tree into a byte buffer.
Tree to write into the buffer.
Buffer to hold the tree's data.
Resizes the buffers backing the tree's nodes and leaves. Will not shrink the buffers below the size needed by the currently resident nodes and leaves.
Pool from which to take and return resources.
The desired number of available leaf slots.
Resets the tree to a fresh post-construction state, clearing out leaves and nodes but leaving the backing resources intact.
Disposes the tree's backing resources, returning them to the Pool currently associated with the tree.
Pool to return resources to.
Disposed trees can be reused if EnsureCapacity or Resize is used to rehydrate them.
Tests if two tree references point to the same data.
First tree to compare.
Second tree to compare.
True if the two trees have the same nodes and node count, false otherwise.
Merges a new leaf node with an existing leaf node, producing a new internal node referencing both leaves, and then returns the index of the leaf node.
Bounding box of the leaf being added.
Index of the parent node that the existing leaf belongs to.
Index of the child wtihin the parent node that the existing leaf belongs to.
Bounding box holding both the new and existing leaves.
Index of the leaf
Adds a leaf to the tree with the given bounding box and returns the index of the added leaf.
Extents of the leaf bounds.
Resource pool to use if resizing is required.
Index of the leaf allocated in the tree's leaf array.
Attempts to swap two nodes. Aborts without changing memory if the swap is contested by another thread.
Uses Node.RefineFlag as a lock-keeping mechanism. All refine flags should be cleared to 0 before a multithreaded processing stage that performs swaps.
First node of the swap pair.
Second node of the swap pair.
True if the nodes were swapped, false if the swap was contested.
Moves the children if the specified node into the correct relative position in memory.
Takes care to avoid contested moves in multithreaded contexts. May not successfully
complete all desired moves if contested.
Node whose children should be optimized.
True if no other threads contested the optimization or if the node is already optimized, otherwise false.
Will return true even if not all nodes are optimized if the reason was a target index outside of the node list bounds.
Begins a cache optimization at the given node and proceeds all the way to the bottom of the tree.
Requires that the targeted node is already at the global optimum position.
Node to begin the optimization process at.
Prepares the jobs associated with a self test. Must be called before a dispatch over PairTest.
Callbacks used to handle individual overlaps detected by the self test.
Number of threads to prepare jobs for.
Cleans up after a multithreaded self test.
Executes a single worker of the multithreaded self test.
Index of the worker executing this set of tests.
Caches input and output for the multithreaded execution of a tree's refit and refinement operations.
Refits the bounding box of every parent of the node recursively to the root.
Node to propagate a node change for.
Removes a leaf at an index. If the index is not at the end of the leaf list, the last leaf is swapped into the removed location.
Index of the leaf to remove.
Former index of the leaf that was moved into the removed leaf's slot, if any.
If leafIndex pointed at the last slot in the list, then this returns -1 since no leaf was moved.
Prepares the jobs associated with a self test. Must be called before a dispatch over PairTest.
Tree to test against itself.
Callbacks used to handle individual overlaps detected by the self test.
Number of threads to prepare jobs for.
Cleans up after a multithreaded self test.
Executes a single worker of the multithreaded self test.
Index of the worker executing this set of tests.