- The region key has been replaced by an i64 in the f64 version of rapier, increasing the range before panics occur.
- Fix
BroadphaseMultiSap
not being able to serialize correctly with serde_json. - Fix
KinematicCharacterController::move_shape
not respecting parametersmax_slope_climb_angle
andmin_slope_slide_angle
.
RigidBodySet
andColliderSet
have a new constructorwith_capacity
.
InteractionGroups
default value formemberships
is nowGROUP_1
(#706)ImpulseJointSet::get_mut
has a new parameterwake_up: bool
, to wake up connected bodies.
- Fix crash when removing a multibody joint, or a rigid-body with a multipody-joint attached to it.
- Fix crash when inserting multibody joints in an arbitrary order (instead of incrementally from root to leaf).
- Fix
BroadphaseMultiSap
not being able to serialize a field with serde_json.
- Implement rotation gizmo for Ball 2D shape (as radius line) in Debug renderer if
DebugRenderMode::COLLIDER_SHAPES
enabled - Implement
Debug
forColliderSet
,InteractionGraph
,MultibodyLink
,MultibodyJointSet
,Multibody
,ImpulseJointSet
- Update parry to v0.17. Refer to its changelog for further details.
- Divided by two the value of each
QueryFilterFlags
variant so that the smallest one is 1 instead of 2 (fixes a bug in rapier.js). BroadphaseMultiSap
now serializes itscolliders_proxy_ids
asVec[(ColliderHandle, BroadPhaseProxyIndex)]
.
- Fix
NaN
values appearing in bodies translation and rotation after a simulation step with a delta time equal to 0 (#660). - Fix crash in the SAP broad-phase when teleporting an object.
- Update to
nalgebra
0.33 andparry
0.16. solve_character_collision_impulses
collisions parameter is now an iterator over references.
This release introduces two new crates:
rapier3d-urdf
for loading URDF files into rapier3d. This will load the rigid-bodies, colliders, and joints.rapier3d-stl
for loading an STL file as a collision shape.
- Add
Multibody::inverse_kinematics
,Multibody::inverse_kinematics_delta
, and::inverse_kinematics_delta_with_jacobian
for running inverse kinematics on a multibody to align one its links pose to the given prescribed pose. - Add
InverseKinematicsOption
to customize some behaviors of the inverse-kinematics solver. - Add
Multibody::body_jacobian
to get the jacobian of a specific link. - Add
Multibody::update_rigid_bodies
to update rigid-bodies based on the multibody links poses. - Add
Multibody::forward_kinematics_single_link
to run forward-kinematics to compute the new pose and jacobian of a single link without mutating the multibody. This can take an optional displacement on generalized coordinates that are taken into account during transform propagation. - Implement
Debug
forColliderBuilder
. - Add
Collider::converted_trimesh
andMeshConverter
for building a collider with a shape computed from a mesh’s index and vertex buffers. That computed shape can currently be aTriMesh
, aCuboid
(covering the mesh’s AABB or OBB), a convex hull, or a convex decomposition. - Implement
Default
forRigidBodyBuilder
. This is equivalent toRigidBodyBuilder::dynamic()
. - Implement
Default
forColliderBuilder
. This is equivalent toColliderBuilder::ball(0.5)
. - Add
RevoluteJoint::angle
to compute the joint’s angle given the rotation of its attached rigid-bodies.
- Renamed
JointAxesMask::X/Y/Z
to::LIN_X/LIN_Y/LIN_Z
; and renamedJointAxisMask::X/Y/Z
to::LinX/LinY/LynZ
to make it clear it is not to be used as angular axes (the angular axis areJointAxesMask::ANG_X/ANG_Y/AngZ
andJointAxisMask::AngX/AngY/AngZ
). - The contact constraints regularization parameters have been changed from
erp/damping_ratio
tonatural_frequency/damping_ratio
. This helps define them in a timestep-length independent way. The new variables are namedIntegrationParameters::contact_natural_frequency
andIntegrationParameters::contact_damping_ratio
. - The
IntegrationParameters::normalized_max_penetration_correction
has been replaced by::normalized_max_corrective_velocity
to make the parameter more timestep-length independent. It is now set to a non-infinite value to eliminate aggressive "popping effects". - The
Multibody::forward_kinematics
method will no longer automatically update the poses of theRigidBody
associated to each joint. InsteadMultibody::update_rigid_bodies
has to be called explicitly. - The
Multibody::forward_kinematics
method will automatically adjust the multibody’s degrees of freedom if the root rigid-body changed type (between dynamic and non-dynamic). It can also optionally apply the root’s rigid-body pose instead of the root link’s pose (useful for example if you modified the root rigid-body pose externally and wanted to propagate it to the multibody). - Remove an internal special-case for contact constraints on fast contacts. The doesn’t seem necessary with the substep solver.
- Remove
RigidBody::add_collider
. This was an implementation detail previously needed bybevy_rapier
. To attach a collider to a rigid-body, useColliderSet::insert_with_parent
orColliderSet::set_parent
. - Rename
JointAxis::X/Y/Z
to::LinX/LinY/LinZ
to avoid confusing it with::AngX/AngY/AngZ
. - Rename
JointAxesMask::X/Y/Z
to::LIN_X/LIN_Y/LIN_Z
to avoid confusing it with::ANG_X/ANG_Y/ANG_Z
. - The function
RigidBody::add_collider
is now private. It was only public because it was needed for some internalbevy_rapier
plumbings, but it is no longer useful. Adding a collider must always go through theColliderSet
. CharacterController::solve_character_collision_impulses
now takes multipleCharacterCollision
as parameter: this change will allow further internal optimizations.QueryPipeline::update
now doesn't need theRigidBodySet
as parameter.- Removed
QueryPipelineMode
. QueryPipeline::update_with_mode
was renamed to::update_with_generator
and now takesimpl QbvhDataGenerator<ColliderHandle>
as parameter see [QueryPipeline::updaters
] module for more information.
- Fix crash when simulating a spring joint between two dynamic bodies.
- Fix kinematic bodies not being affected by gravity after being switched back to dynamic.
- Fix regression on contact force reporting from contact force events.
- Fix kinematic character controller getting stuck against vertical walls.
- Fix joint limits/motors occasionally not being applied properly when one of the attached rigid-bodies is fixed.
- Fix an issue where contacts would be completely ignored between two convex shapes.
Many stability improvements were added as part of this release. To see illustrations of some of these changes, see #625.
- Add
RigidBody::predict_position_using_velocity
to predict the next position of the rigid-body based only on its current velocity. - Add
Collider::copy_from
to copy most collider attributes to an existing collider. - Add
RigidBody::copy_from
to copy most rigid-body attributes to an existing rigid-body. - Add the
BroadPhase
trait and expect an implementor of this trait as input toPhysicsPipeline::step
. - Implement a 2D block-solver as well as warmstarting. Significantly improves stacking capabilities. Generally reduces the "pop" effect that can happen due to penetration corrections.
- Add
RigidBodyBuilder::soft_ccd_prediction
andRigidBody::set_soft_ccd_prediction
to enablesoft-ccd
: a form of CCD based on predictive contacts. This is helpful for objects moving moderately fast. This form of CCD is generally cheaper than the normal (time-dropping) CCD implemented so far. It is possible to combine both soft-ccd and time-dropping ccd. - Add a
ColliderBuilder::contact_skin
,Collider::set_contact_skin
, andCollider::contact_skin
. This forces the solver te maintain a gap between colliders with non-zero contact skin, as if they had a slight margin around them. This helps performance and stability for thin objects (like triangle meshes). - Internal edges were reworked to avoid dropping contacts that would help with stability, and improve stability of
collisions between two triangle meshes. The
TriMeshFlags::FIX_INTERNAL_EDGES
andHeightFieldFlags::FIX_INTERNAL_EDGES
flags were added to enable internal edges handling. - Add
IntegrationParameters::length_units
to automatically adjust internal thresholds when the user relies on custom length units (e.g. pixels in 2D).
Many shape-casting related functions/structs were renamed. Check out the CHANGELOG for parry 0.15.0 for additional details.
- Renamed
BroadPhase
toBroadPhaseMultiSap
. TheBroadPhase
is now a trait that can be implemented for providing a custom broad-phase to rapier. Equivalently, theDefaultBroadPhase
type alias can be used in place ofBroadPhaseMultiSap
. - The kinematic character controller autostepping is now disabled by default.
- Add
KinematicCharacterController::normal_nudge_factor
used to help getting the character unstuck due to rounding errors. - Rename
TOI
toShapeCastHit
. - Rename many fields from
toi
totime_of_impact
. - The
QueryPipeline::cast_shape
method now takes aShapeCastOptions
instead of themax_toi
andstop_at_penetration
parameters. This allows a couple of extra configurations, including the ability to have the shape-cast target a specific distance instead of actual shape overlap.
The main highlight of this release is the implementation of a new non-linear constraints solver for better stability and increased convergence rates. See #579 for additional information.
In order to adjust the number of iterations of the new solver, simply
adjust IntegrationParameters::num_solver_iterations
.
If recovering the old solver behavior is useful to you, call IntegrationParameters::switch_to_standard_pgs_solver()
.
It is now possible to specify some additional solver iteration for specific rigid-bodies (and everything interacting
with it directly or indirectly through contacts and joints): RigidBodyBuilder::additional_solver_iterations
and
RigidBodyBuilder::set_additional_solver_iterations
. This allows for higher-accuracy on subsets of the physics scene
without affecting performance of the other parts of the simulation.
- Fix bug causing angular joint limits and motor to sometimes only take into account half of the angles specified by the user.
- Fix bug where collisions would not be re-computed after a collider was re-enabled.
- Add a
SpringJoint
andSpringJointBuilder
for simulating springs with customizable stiffness and damping coefficients. - Add
SphericalJoint::local_frame1/2
,::set_local_frame1/2
, andSphericalJointBuilder::local_frame1/2
to set both the joint’s anchor and reference orientation. - Add
EffectiveCharacterMovement::is_sliding_down_slope
to indicate if the character controlled by the kinematic character controller is sliding on a slope that is too steep. - Add
Wheel::side_friction_stiffness
to customize the side friction applied to the vehicle controller’s wheel. - Add
Wheel::raycast_info
to access more wheel information relative to the ground. - Add
DebugRenderStyle::disabled_color_multiplier
to make the debug-renderer color disabled object differently. - Fix incorrect update of angular degrees-of-freedoms on spherical multibody joints.
- Fix debug-renderer showing moved kinematic rigid-bodies only at their initial position.
- Make
Wheel::friction_slip
public to customize the front friction applied to the vehicle controller’s wheels. - Add the
DebugRenderBackend::filter_object
predicate that can be implemented to apply custom filtering rules on the objects being rendered. - Switch the testbed to
bevy 0.12
and use its new Gizmos API for rendering lines. - Rename
NarrowPhase::contacts_with
toNarrowPhase::contact_pairs_with
. - Rename
NarrowPhase::intersections_with
toNarrowPhase::intersection_pairs_with
.
- Fix issue with convex polyhedron jitter due to missing contacts.
- Fix character controller getting stuck against vertical walls.
- Fix character controller’s snapping to ground not triggering sometimes.
- Fix character controller’s horizontal offset being mostly ignored and some instances of vertical offset being ignored.
- Fix bug resulting in dynamic rigid-bodies acting as kinematic bodies after being disabled and then re-enabled.
- Add
RigidBody::set_enabled
,RigidBody::is_enabled
,RigidBodyBuilder::enabled
to enable/disable a rigid-body without having to delete it. Disabling a rigid-body attached to a multibody joint isn’t supported yet. - Add
Collider::set_enabled
,Collider::is_enabled
,ColliderBuilder::enabled
to enable/disable a collider without having to delete it. - Add
GenericJoint::set_enabled
,GenericJoint::is_enabled
to enable/disable a joint without having to delete it. Disabling a multibody joint isn’t supported yet. - Add
DynamicRayCastVehicleController
, a vehicle controller based on ray-casting and dynamic rigid-bodies (mostly a port of the vehicle controller from Bullet physics). - Add
RigidBody::user_force
andRigidBody::user_torque
to read the forces or torques added by the user to a dynamic rigid-body. - Add
RigidBody::locked_axes
to get the rigid-body axes that were locked by the user.
- Add the
QueryPipeline
as an optional argument toPhysicsPipeline::step
andCollisionPipeline::step
. If this argument is specified, then the query pipeline will be incrementally (i.e. more efficiently) update at the same time as these other pipelines. In that case, callingQueryPipeline::update
aPhysicsPipeline::step
isn’t needed. RigidBody::set_body_type
now takes an extra boolean argument indicating if the rigid-body should be woken-up (if it becomes dynamic).RigidBody::mass_properties
now also returns the world-space mass-properties of the rigid-body.
- Fix bug resulting in rigid-bodies being awakened after they are created, even if they are created sleeping.
- Fixed docs build on
docs.rs
.
- Implement
Copy
forCharacterCollision
. - Implement conversion (
From
trait) betweenGroup
andu32
. - Add
ColliderBuilder::trimesh_with_flags
to build a triangle mesh with specific flags controlling its initialization.
- Rename
AABB
toAabb
to comply with Rust’s style guide. - Switch to
parry 0.11
.
- Fix internal edges of 3D triangle meshes or 3D heightfields generating invalid contacts preventing balls from moving straight.
- Add a kinematic character controller implementation. See the
control
module. The character controller currently supports the following features:- Slide on uneven terrains
- Interaction with dynamic bodies.
- Climb stairs automatically.
- Automatically snap the body to the floor when going downstairs.
- Prevent sliding up slopes that are too steep
- Prevent sliding down slopes that are not steep enough
- Interactions with moving platforms.
- Report information on the obstacles it hit on its path.
- Implement
serde
serialization/deserialization forCollisionEvents
when theserde-serialize
feature is enabled
- The methods
Collider::set_rotation
,RigidBody::set_rotation
, andRigidBody::set_next_kinematic_rotation
now take a rotation (UnitQuaternion
orUnitComplex
) instead of a vector/angle. - The method
QueryFilter::exclude_dynamic
is now a static method (theself
argument was removed). - The
QueryPipeline::cast_shape
method has a new argumentstop_at_penertation
. If set tofalse
, the linear shape-cast won’t immediately stop if the shape is penetrating another shape at its starting point and its trajectory is such that it’s on a path to exit that penetration state. - The
InteractionGroups
is now a set of explicit bit flags instead of a rawu32
. - The world-space mass properties of rigid-bodies are now updated automatically whenever the user changes their position.
- Fix unpredictable broad-phase panic when using small colliders in the simulation.
- Fix collision events being incorrectly generated for any shape that produces multiple contact manifolds (like triangle meshes).
- Fix panic in the
CollisionPipeline
if a collider is both added and removed before a call toCollisionPipeline::step
.
- The
RigidBodyBuilder::additional_mass
method will now result in the additional angular inertia being automatically computed based on the shapes of the colliders attached to the rigid-body. - Remove the deprecated methods
RigidBodyBuilder::mass
,::principal_angular_inertia
,::principal_inertia
. - Remove the methods
RigidBodyBuilder::additional_principal_angular_inertia
. UseRigidBodyBuilder::additional_mass_properties
instead. - The
Collider::density
method now always returns aReal
(instead of anOption<Real>
). - Rename
RigidBody::restrict_rotations
andRigidBody::restrict_translations
toRigidBody::set_enabled_rotations
andRigidBody::set_enabled_translations
. - Rename
RigidBodyBuilder::restrict_rotations
andRigidBodyBuilder::restrict_translations
toRigidBodyBuilder::enabled_rotations
andRigidBodyBuilder::enabled_translations
.
- Add
RigidBody::recompute_mass_properties_from_colliders
to force the immediate computation of a rigid-body’s mass properties (instead of waiting for them to be recomputed during the next timestep). This is useful to be able to read immediately the result of a change of a rigid-body additional mass-properties or a change of one of its collider’s mass-properties. - Add
RigidBody::set_additional_mass
to set the additional mass for the collider. The additional angular inertia is automatically computed based on the attached colliders shapes. - Add
Collider::set_density
,::set_mass
,set_mass_properties
, to alter a collider’s mass properties. Note that::set_mass
will result in the collider’s angular inertia being automatically computed based on this mass and on its shape. - Add
ColliderBuilder::mass
to set the mass of the collider instead of its density. Its angular inertia tensor will be automatically computed based on this mass and its shape. - Add
Collider::mass
andCollider::volume
to retrieve the mass or volume of a collider. - Add the
QueryFilter
that is now used by all the scene queries instead of theCollisionGroups
andFn(ColliderHandle) -> bool
closure. ThisQueryFilter
provides easy access to most common filtering strategies (e.g. dynamic bodies only, excluding one particular collider, etc.) for scene queries. - Add force reporting based on contact force events. The
EventHandler
trait has been modified to include the methodEventHandler::handle_contact_force_event
. Contact force events are generated whenever the sum of the magnitudes of all the forces between two colliders is greater than any of theirCollider::contact_force_event_threshold
values (only the colliders wit theActiveEvents::CONTACT_FORCE_EVENT
flag set are taken into account for this threshold). - Add the
ContactForceEvent
struct that is generated by theChannelEventCollector
to report contact force events.
- Fix incorrect sensor events being generated after collider removal.
- Fix bug where the CCD thickness wasn’t initialized properly.
- Fix bug where the contact compliance would result in undesired tunneling, despite CCD being enabled.
- Add a
wake_up: bool
argument to theImpulseJointSet::insert
andMultibodyJointSet::insert
to automatically wake-up the rigid-bodies attached to the inserted joint. - The methods
ImpulseJointSet::remove/remove_joints_attached_to_rigid_body
,MultibodyJointSet::remove/remove_joints_attached_to_rigid_body
andMultibodyjointSet::remove_multibody_articulations
no longer require thebodies
andislands
arguments. - Make the
instant
dependency optional, behind aprofiler
cargo feature. - Rename STATIC to FIXED in the
ActiveCollisionTypes
flags. - Rename
ImpulseJointSet::joints_with
to::attached_joints
. Add the joint’s handle to the closure arguments. - Make the default debug-render less noisy out-of-the-box by only rendering joints, rigid-bodies, and colliders by default.
- Debug-renderer: add rendering of contacts, solver contacts, and collider Aabbs
- Add
MultibodyJointSet::attached_joints
to return all the multibody joints attached to a given rigid-body.
- Fix the simulation when the
parallel
feature is enabled. - Fix bug where damping would not be applied properly to some bodies.
- Fix panics caused by various situations (contact or joints) involving rigid-bodies with locked translations/rotations.
- Fix bug where collider modifications (like changes of collision groups, or shape) would not wake-up their attached rigid-body, or would not have any effect on pre-existing contacts.
- Fix the automatic update of a rigid-body’s mass properties after changing one of its attached colliders.
- Fix the broad-phase becoming potentially invalid after a change of collision groups.
- Switch to
nalgebra
0.31. - Switch to
parry
0.9. - Rename
JointHandle
toImpulseJointHandle
. - Rename
RigidBodyMassPropsFlags
toLockedAxes
. - Rename
RigidBody::apply_force
,::apply_torque
,::apply_force_at_point
to::add_force
,::add_torque
, and::add_force_at_point
to better reflect the fact that they are not cleared at the end of the timestep. - Rename
RigidBodyType::Static
toRigidBodyType::Fixed
to avoid confusion with thestatic
keyword. - All method referring to
static
rigid-bodies now usefixed
instead ofstatic
. - Rename
RigidBodyBuilder::new_static, new_kinematic_velocity_based, new_kinematic_velocity_based
toRigidBodyBuilder::fixed, kinematic_velocity_based, kinematic_velocity_based
. - The
ContactEvent
andIntersectionEvent
have been replaced by a single enumCollisionEvent
in order to simplify the user’s event handling. - The
ActiveEvents::CONTACT_EVENTS
andActiveEvents::INTERSECTION_EVENTS
flags have been replaced by a single flagActiveEvents::COLLISION_EVENTS
. - Joint motors no longer have a
VelocityBased
model. The new choices areAccelerationBased
andForceBased
which are more stable. - Calling the
.build()
function from builders (RigidBodyBuilder
,ColliderBuilder
, etc.) is no longer necessary when adding them to sets. It is automatically called thanks toInto<_>
implementations. - The
ComponentSet
abstractions (and related_generic
methods likePhysicsPipeline::step_generic
) have been removed. Custom storage for colliders and rigid-bodies are no longer possible: use the built-inRigidBodySet
andColliderSet
instead.
These are changes in the behavior of the physics engine that are not necessarily reflected by an API change. See #304 for extensive details.
RigidBody::set_linvel
andRigidBody::set_angvel
no longer modify the velocity of static bodies.RigidBody::set_body_type
will reset the velocity of a rigid-body to zero if it is static.- Don’t automatically clear forces at the end of a timestep.
- Don’t reset the velocity of kinematic bodies to zero at the end of the timestep.
- Events
CollisionEvent::Stopped
are now generated after a collider is removed.
- Significantly improve the API of joints by adding:
- Builders based on the builder pattern.
- Getters and setters for all joints.
- Method to convert a
GenericJoint
to one of the more specific joint type.
- Improve stability of joint motors.
- Adds a
bool
argument toRigidBodySet::remove
. If set tofalse
, the colliders attached to the rigid-body won’t be automatically deleted (they will only be detached from the deleted rigid-body instead). - Add
RigidBody::reset_forces
andRigidBody::reset_torques
to reset all the forces and torques added to the rigid-body by the user. - Add the
debug-render
cargo feature that enables theDebugRenderPipeline
: a line-based backend-agnostic renderer to debug the state of the physics engine.
- Fixed
RigidBody::restrict_rotations
to properly take into account the axes to lock.
- All the impulse-based joints have been replaced by a single generic 6-Dofs joint in 3D
(or 3-Dofs joint in 2D) named
ImpulseJoint
. TheRevoluteJoint, PrismaticJoint, FixedJoint
, andSphericalJoint
(formerly namedBallJoint
) structures still exist but are just convenient ways to initialize the genericImpulseJoint
. - Our constraints solver has been modified. Before we used one velocity-based resolution followed by one position-based resolution. We are now using two velocity-based resolution: the first one includes constraints regularization whereas the second one doesn’t. This simplifies the resolution code significantly while offering stiffer results.
- Added multibody joints: joints based on the reduced-coordinates modeling. These joints can’t violate their positional constraint.
- Implement
Default
for most of the struct that supports it.
- Fix a bug causing large moving colliders to miss some collisions after some time.
- Fix invalid forces generated by contacts with position-based kinematic bodies.
- Fix a bug where two colliders without parent would not have their collision computed even if the appropriate flags were set.
Check out the user-guide for the JS/Typescript bindings for rapier. It has been fully rewritten and is now exhaustive! Check it out on rapier.rs
- Joint limits are now implemented for all joints that can support them (prismatic, revolute, and ball joints).
- Switch to
nalgebra 0.29
.
- Fix the build of Rapier when targeting emscripten.
- Add
Collider::set_translation_wrt_parent
to change the translation of a collider with respect to its parent rigid-body. - Add
Collider::set_rotation_wrt_parent
to change the translation of a collider with respect to its parent rigid-body.
- Implement
Clone
forIslandManager
.
JointSet::insert
no longer takes the rigid-body set in its arguments.- Modify the testbed's plugin system to let plugins interact with the rendering.
- Implement
PartialEq
for most collider and rigid-body components.
- Make the method JointSet::remove_joints_attached_to_rigid_body public so that it can can be called externally for letting component-based Rapier integration call it to cleanup joints after a rigid-body removal.
- Fix a panic that could happen when the same collider is listed twice in the removed_colliders array.
- Add
rapier::prelude::nalgebra
so that thevector!
andpoint!
macros work out-of-the-box after importing the prelude:use rapier::prelude::*
The user-guide has been fully rewritten and is now exhaustive! Check it out on rapier.rs
- A prelude has been added in order to simplify the most common imports. For example:
use rapier3d::prelude::*
- Add
RigidBody::set_translation
andRigidBody.translation()
. - Add
RigidBody::set_rotation
andRigidBody.rotation()
. - Add
RigidBody::set_next_translation
for setting the next translation of a position-based kinematic body. - Add
RigidBody::set_next_rotation
for setting the next rotation of a position-based kinematic body. - Add kinematic bodies controlled at the velocity level: use
RigidBodyBuilder::new_kinematic_velocity_based
orRigidBodyType::KinematicVelocityBased
. - Add the cargo feature
debug-disable-legitimate-fe-exceptions
that can be enabled for debugging purpose. This will disable floating point exceptions whenever they happen at places where we do expect them to happen (for example some SIMD code do generate NaNs which are filtered out by lane-wise selection).
The use of RigidBodySet, ColliderSet, RigidBody, Collider
is no longer mandatory. Rigid-bodies and colliders have
been split into multiple components that can be stored in a user-defined set. This is useful for integrating Rapier
with other engines (for example this allows us to use Bevy's Query as our rigid-body/collider sets).
The RigidBodySet, ColliderSet, RigidBody, Collider
are still the best option for whoever doesn't want to
provide their own component sets.
- Renamed
BodyStatus
toRigidBodyType
. RigidBodyBuilder::translation
now takes a vector instead of individual components.RigidBodyBuilder::linvel
now takes a vector instead of individual components.- The
RigidBodyBuilder::new_kinematic
has be replaced by theRigidBodyBuilder::new_kinematic_position_based
andRigidBodyBuilder::new_kinematic_velocity_based
constructors. - The
RigidBodyType::Kinematic
variant has been replaced by two variants:RigidBodyType::KinematicVelocityBased
andRigidBodyType::KinematicPositionBased
.
Colliderbuilder::translation
now takes a vector instead of individual components.- The way
PhysicsHooks
are enabled changed. Now, a physics hooks is executed if any of the two colliders involved in the contact/intersection pair contains the relatedPhysicsHooksFlag
. These flags are configured on each collider withColliderBuilder::active_hooks
. As a result, there is noPhysicsHooks::active_hooks
method any more. - All events are now disabled for all colliders by default. Enable events for specific colliders by setting its
active_events
bit mask toActiveEvents::CONTACT_EVENTS
and/orActiveEvents::PROXIMITY_EVENTS
. - Add a simpler way of enabling collision-detection between colliders attached to two non-dynamic rigid-bodies: see
ColliderBuilder::active_collision_types
. - The
InteractionGroups
is now a structures with twou32
integers: one integers for the groups membership and one for the group filter mask. (Before, both were only 16-bits wide, and were packed into a singleu32
). - Before, sensor colliders had a default density set to 0.0 whereas non-sensor colliders had a default density of 1.0. This has been unified by setting the default density to 1.0 for both sensor and non-sensor colliders.
- Colliders are no longer required to be attached to a rigid-body. Therefore,
ColliderSet::insert
only takes the collider as argument now. In order to attach the collider to a rigid-body, (i.e., the old behavior ofColliderSet::insert
), useColliderSet::insert_with_parent
. - Fixed a bug where collision groups were ignored by CCD.
- The fields
FixedJoint::local_anchor1
andFixedJoint::local_anchor2
have been renamed toFixedJoint::local_frame1
andFixedJoint::local_frame2
.
- The field
ContactPair::pair
(which contained two collider handles) has been replaced by two fields:ContactPair::collider1
andContactPair::collider2
. - The list of active dynamic bodies is now retrieved with
IslandManager::active_dynamic_bodies
instead ofRigidBodySet::iter_active_dynamic
. - The list of active kinematic bodies is now retrieved with
IslandManager::active_kinematic_bodies
instead ofRigidBodySet::iter_active_kinematic
. NarrowPhase::contacts_with
now returns animpl Iterator<Item = &ContactPair>
instead of anOption<impl Iterator<Item = (ColliderHandle, ColliderHandle, &ContactPair)>>
. The colliders handles can be read from the contact-pair itself.NarrowPhase::intersections_with
now returns an iterator directly instead of anOption<impl Iterator>
.- Rename
PhysicsHooksFlags
toActiveHooks
. - Add the contact pair as an argument to
EventHandler::handle_contact_event
- Switch to nalgebra 0.26.
- Implement
Serialize
andDeserialize
for theCCDSolver
.
- Fix a crash that could happen after adding and then removing a collider right away, before stepping the simulation.
- Fixed a bug in the broad-phase that could cause non-determinism after snapshot restoration.
- Add the support of Continuous Collision Detection (CCD) to make sure that some fast-moving objects (chosen by the user) don't miss any contacts. This is done by using motion-clamping, i.e., each fast-moving rigid-body with CCD enabled will be stopped at the time where their first contact happen. This will result in some "time loss" for that rigid-body. This loss of time can be reduced by increasing the maximum number of CCD substeps executed (the default being 1).
- Add the support of collider modification. Now, most of the characteristics of a collider can be modified after the collider has been created.
- We now use an implicit friction cone for handling friction, instead of a pyramidal approximation of the friction cone. This means that friction will now behave in a more isotropic way (i.e. more realistic Coulomb friction).
- Add the support of custom filters for the
QueryPipeline
. So far, interaction groups (bit masks) had to be used to exclude from colliders from a query made with theQueryPipeline
. Now it is also possible to provide a custom closures to apply arbitrary user-defined filters. - It is now possible to solve penetrations using the velocity solver instead of (or alongside) the
position solver (this is disabled by default, set
IntegrationParameters::velocity_based_erp
to a value> 0.0
to enable.).
Added the methods:
ColliderBuilder::halfspace
to create a collider with an unbounded plane shape.Collider::shape_mut
to get a mutable reference to its shape.Collider::set_shape
,::set_restitution_combine_rule
,::set_position_wrt_parent
,::set_collision_groups
::set_solver_groups
to change various properties of a collider after its creation.RigidBodyBuilder::ccd_enabled
to enable CCD for a rigid-body.
- The
target_dist
argument ofQueryPipeline::cast_shape
was removed. RigidBodyBuilder::mass_properties
has been deprecated, replaced by::additional_mass_properties
.RigidBodyBuilder::mass
has been deprecated, replaced by::additional_mass
.RigidBodyBuilder::principal_angular_inertia
has been deprecated, replaced by::additional_principal_angular_inertia
.- The field
SolveContact::data
has been replaced by the fieldsSolverContact::warmstart_impulse
,SolverContact::warmstart_tangent_impulse
, andSolverContact::prev_rhs
. - All the fields of
IntegrationParameters
that we don't use have been removed. NarrowPhase::maintain
has been renamed toNarrowPhase::handle_user_changes
.BroadPhase::maintain
has been removed. UseBroadPhase::update
directly.
- The Broad-Phase algorithm has been completely reworked to support large colliders properly (until now they could result in very large memory and CPU usage).
- Fix a determinism problem that may happen after snapshot restoration, if a rigid-body is sleeping at the time the snapshot is taken.
- The support of dominance groups have been added. Each rigid-body is part of a dominance group in [-127; 127] (the default is 0). If two rigid-body are in contact, the one with the highest dominance will act as if it has an infinite mass, making it immune to the forces the other body would apply on it. See #122 for further details.
- The support for contact modification has been added. This can bee used to simulate conveyor belts, one-way platforms and other non-physical effects. It can also be used to simulate materials with variable friction and restitution coefficient on a single collider. See #120 for further details.
- The support for joint motors have been added. This can be used to control the position and/or velocity of a joint based on a spring-like equation. See #119 for further details.
- The
ContactPairFilter
andIntersectionPairFilter
traits have been removed. They are both combined in a single new trait:PhysicsHooks
.
In this release we are dropping ncollide
and use our new crate parry
instead! This comes with a lot of new features, as well as two new crates: rapier2d-f64
and
rapier3d-f64
for physics simulation with 64-bits floats.
- Added a
RAPIER.version()
function at the root of the package to retrieve the version of Rapier as a string.
Several geometric queries have been added to the QueryPipeline
:
QueryPipeline::intersections_with_ray
: get all colliders intersecting a ray.QueryPipeline::intersection_with_shape
: get one collider intersecting a shape.QueryPipeline::project_point
: get the projection of a point on the closest collider.QueryPipeline::intersections_with_point
: get all the colliders containing a point.QueryPipeline::cast_shape
: get the first collider intersecting a shape moving linearly (aka. sweep test).QueryPipeline::intersections_with_shape
: get all the colliders intersecting a shape.
Several new shape types are now supported:
RoundCuboid
,Segment
,Triangle
,RoundTriangle
,Polyline
,ConvexPolygon
(2D only),RoundConvexPolygon
(2D only),ConvexPolyhedron
(3D only),RoundConvexPolyhedron
(3D only),RoundCone
(3D only).
It is possible to build ColliderDesc
using these new shapes:
ColliderBuilder::round_cuboid
,ColliderBuilder::segment
,ColliderBuilder::triangle
,ColliderBuilder::round_triangle
,ColliderBuilder::convex_hull
,ColliderBuilder::round_convex_hull
,ColliderBuilder::polyline
,ColliderBuilder::convex_decomposition
,ColliderBuilder::round_convex_decomposition
,ColliderBuilder::convex_polyline
(2D only),ColliderBuilder::round_convex_polyline
(2D only),ColliderBuilder::convex_mesh
(3D only),ColliderBuilder::round_convex_mesh
(3D only),ColliderBuilder::round_cone
(3D only).
It is possible to specify different rules for combining friction and restitution coefficients of the two colliders involved in a contact with:
ColliderDesc::friction_combine_rule
, andColliderDesc::restitution_combine_rule
.
Various RigidBody-related getter and setters have been added:
RigidBodyBuilder::gravity_scale
,RigidBody::gravity_scale
,RigidBody::set_gravity_scale
to get/set the scale factor applied to the gravity affecting a rigid-body. Setting this to 0.0 will make the rigid-body ignore gravity.RigidBody::set_linear_damping
andRigidBody::set_angular_damping
to set the linear and angular damping of the rigid-body.RigidBodyBuilder::restrict_rotations
to prevent rotations along specific coordinate axes. This replaces the three boolean arguments previously passed to.set_principal_angular_inertia
.
Breaking changes related to contacts:
- The way contacts are represented changed. Refer to the documentation
of
parry::query::ContactManifold
,parry::query::TrackedContact
andrapier::geometry::ContactManifoldData
andrapier::geometry::ContactData
for details.
Breaking changes related to rigid-bodies:
- The
RigidBodyDesc.setMass
takes only one argument now. UseRigidBodyDesc.lockTranslations
to lock the translational motion of the rigid-body. - The
RigidBodyDesc.setPrincipalAngularInertia
no longer have boolean parameters to lock rotations. UseRigidBodyDesc.lockRotations
orRigidBodyDesc.restrictRotations
to lock the rotational motion of the rigid-body.
Breaking changes related to colliders:
- The collider shape type has been renamed from
ColliderShape
toSharedShape
(now part of the Parry crate). - The
Polygon
shape no longer exists. For a 2D convex polygon, use aConvexPolygon
instead. - All occurrences of
Trimesh
have been replaced byTriMesh
(note the change in case).
Breaking changes related to events:
- Rename all occurrences of
Proximity
toIntersection
. - The
Proximity
enum has been removed, it's replaced by a boolean.
- Fix a bug in angular inertia tensor computation that could cause rotations not to work properly.
- Add
RigidBody::set_mass_properties
to set the mass properties of an already-constructed rigid-body.
- The
RigidBodyBuilder::principal_inertia
method has been deprecated and renamed toprincipal_angular_inertia
for clarity.
- The rigid-body
linvel
,angvel
, andposition
fields are no longer public. Access using their corresponding getters/setters. For example:rb.linvel()
,rb.set_linvel(vel, true)
. - Add
RigidBodyBuilder::sleeping(true)
to allow the creation of a rigid-body that is asleep at initialization-time.
- Add
RigidBodyBuilder::lock_rotations
to prevent a rigid-body from rotating because of forces. - Add
RigidBodyBuilder::lock_translations
to prevent a rigid-body from translating because of forces. - Add
RigidBodyBuilder::principal_inertia
for setting the principal inertia of a rigid-body, and/or preventing the rigid-body from rotating along a specific axis. - Change
RigidBodyBuilder::mass
by adding a bool parameter indicating whether or not the collider contributions should be taken into account in the future too.
- Add
NarrowPhase::contacts_with
andNarrowPhase::proximities_with
to retrieve all the contact pairs and proximity pairs involving a specific collider. - Add
NarrowPhase::contact_pair
andNarrowPhase::proximity_pair
to retrieve one specific contact pair or proximity pair if it exists. - Add
NarrowPhase::contact_pairs
, andNarrowPhase::proximity_pairs
to retrieve all the contact or proximity pairs detected by the narrow-phase.
- Add linear and angular damping. The damping factor can be set with
RigidBodyBuilder::linear_damping
andRigidBodyBuilder::angular_damping
. - Implement
Clone
for almost everything that can be worth cloning. - Allow setting the initial mass and mass properties of a rigid-bodies using
RigidBodyBuilder::mass
andRigidBodyBuilder::mass_properties
. - The restitution coefficient of colliders is now taken into account by the physics solver.
- Fix non-determinism problem when using triangle-meshes, cone, cylinders, or capsules.
- Add
JointSet::remove(...)
to remove a joint from theJointSet
.
- Collider shapes are now trait-objects instead of a
Shape
enum. - Add a user-defined
u128
to each colliders and rigid-bodies for storing user data. - Add the support for
Cylinder
,RoundCylinder
, andCone
shapes. - Added the support for collision filtering based on bit masks (often known as collision groups, collision masks, or
collision layers in other physics engines). Each collider has two groups. Their
collision_groups
is used for filtering what pair of colliders should have their contacts computed by the narrow-phase. Theirsolver_groups
is used for filtering what pair of colliders should have their contact forces computed by the constraints solver. - Collision groups can also be used to filter what collider should be hit by a ray-cast performed by
the
QueryPipeline
. - Added collision filters based on user-defined trait-objects. This adds two traits
ContactPairFilter
andProximityPairFilter
that allows user-defined logic for determining if two colliders/sensors are allowed to interact. - The
PhysicsPipeline::step
method now takes two additional arguments: the optional&ContactPairFilter
and&ProximityPairFilter
for filtering contact and proximity pairs.
- Fix panic in TriMesh construction and QueryPipeline update caused by a stack overflow or a subtraction underflow.
The most significant change on this version is the addition of the QueryPipeline
responsible for performing
scene-wide queries. So far only ray-casting has been implemented.
- Add
ColliderSet::remove(...)
to remove a collider from theColliderSet
. - Replace
PhysicsPipeline::remove_rigid_body
byRigidBodySet::remove
. - The
JointSet.iter()
now returns an iterator yielding(JointHandle, &Joint)
instead of just&Joint
. - Add
ColliderDesc::translation(...)
to set the translation of a collider relative to the rigid-body it is attached to. - Add
ColliderDesc::rotation(...)
to set the rotation of a collider relative to the rigid-body it is attached to. - Add
ColliderDesc::position(...)
to set the position of a collider relative to the rigid-body it is attached to. - Add
Collider::position_wrt_parent()
to get the position of a collider relative to the rigid-body it is attached to. - Modify
RigidBody::set_position(...)
so it also resets the next kinematic position to the same value. - Deprecate
Collider::delta()
in favor of the newCollider::position_wrt_parent()
. - Fix multiple issues occurring when having colliders resulting in a non-zero center-of-mass.
- Fix a crash happening when removing a rigid-body with a collider, stepping the simulation, adding another rigid-body with a collider, and stepping the simulation again.
- Fix NaN when detection contacts between two polygonal faces where one has a normal perfectly perpendicular to the separating vector.
- Fix bug collision detection between trimeshes and other shapes. The bug appeared depending on whether the trimesh collider was added before the other shape's collider or after.