18 KiB
v0.9.0
The user-guide has been fully rewritten and is now exhaustive! Check it out on rapier.rs
Added
- A prelude has been added in order to simplify the most common imports. For example:
use rapier3d::prelude::* - Add
RigidBody::set_translationandRigidBody.translation(). - Add
RigidBody::set_rotationand `RigidBody.rotation(). - Add
RigidBody::set_next_translationfor setting the next translation of a position-based kinematic body. - Add
RigidBody::set_next_rotationfor setting the next rotation of a position-based kinematic body. - Add kinematic bodies controlled at the velocity level: use
RigidBodyBuilder::new_kinematic_velocity_basedorRigidBodyType::KinematicVelocityBased.
Modified
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 use 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.
Rigid-bodies
- Renamed
BodyStatustoRigidBodyType. RigidBodyBuilder::translationnow takes a vector instead of individual components.RigidBodyBuilder::linvelnow takes a vector instead of individual components.- The
RigidBodyBuilder::new_kinematichas be replaced by theRigidBodyBuilder::new_kinematic_position_basedandRigidBodyBuilder::new_kinematic_velocity_basedconstructors. - The
RigidBodyType::Kinematicvariant has been replaced by two variants:RigidBodyType::KinematicVelocityBasedandRigidBodyType::KinematicPositionBased.
Colliders
Colliderbuilder::translationnow takes a vector instead of individual components.- The way
PhysicsHooksare 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_hooksmethod any more. - All events are now disabled for all colliders by default. Enable events for specific colliders by setting its
active_eventsbit mask toActiveEvents::CONTACT_EVENTSand/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
InteractionGroupsis now a structures with twou32integers: 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::insertonly 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.
Joints
- The fields
FixedJoint::local_anchor1andFixedJoint::local_anchor2have been renamed toFixedJoint::local_frame1andFixedJoint::local_frame2.
Pipelines and others
- The field
ContactPair::pair(which contained two collider handles) has been replaced by two fields:ContactPair::collider1andContactPair::collider2. - The list of active dynamic bodies is no retrieved with
IslandManager::active_dynamic_bodiesinstead ofRigidBodySet::iter_active_dynamic. - The list of active kinematic bodies is no retrieved with
IslandManager::active_kinematic_bodiesinstead ofRigidBodySet::iter_active_kinematic. NarrowPhase::contacts_withnow 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_withnow returns an iterator directly instead of anOption<impl Iterator>.- Rename
PhysicsHooksFlagstoActiveHooks. - Add the contact pair as an argument to
EventHandler::handle_contact_event
v0.8.0
Modified
- Switch to nalgebra 0.26.
v0.7.2
Added
- Implement
SerializeandDeserializefor theCCDSolver.
Fixed
- Fix a crash that could happen after adding and then removing a collider right away, before stepping the simulation.
v0.7.1
Fixed
- Fixed a bug in the broad-phase that could cause non-determinism after snapshot restoration.
v0.7.0
Added
- 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_erpto a value> 0.0to enable.).
Added the methods:
ColliderBuilder::halfspaceto create a collider with an unbounded plane shape.Collider::shape_mutto get a mutable reference to its shape.Collider::set_shape,::set_restitution_combine_rule,::set_position_wrt_parent,::set_collision_groups::set_solver_groupsto change various properties of a collider after its creation.RigidBodyBuilder::ccd_enabledto enable CCD for a rigid-body.
Modified
- The
target_distargument ofQueryPipeline::cast_shapewas removed. RigidBodyBuilder::mass_propertieshas been deprecated, replaced by::additional_mass_properties.RigidBodyBuilder::masshas been deprecated, replaced by::additional_mass.RigidBodyBuilder::principal_angular_inertiahas been deprecated, replaced by::additional_principal_angular_inertia.- The field
SolveContact::datahas been replaced by the fieldsSolverContact::warmstart_impulse,SolverContact::warmstart_tangent_impulse, andSolverContact::prev_rhs. - All the fields of
IntegrationParametersthat we don't use have been removed. NarrowPhase::maintainhas been renamed toNarrowPhase::handle_user_changes.BroadPhase::maintainhas been removed. UseBroadPhase::updatedirectly.
Fixed
- 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).
v0.6.1
Fixed
- Fix a determinism problem that may happen after snapshot restoration, if a rigid-body is sleeping at the time the snapshot is taken.
v0.6.0
Added
- 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.
Removed
- The
ContactPairFilterandIntersectionPairFiltertraits have been removed. They are both combined in a single new trait:PhysicsHooks.
v0.5.0
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
- 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_scaleto 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_dampingandRigidBody::set_angular_dampingto set the linear and angular damping of the rigid-body.RigidBodyBuilder::restrict_rotationsto prevent rotations along specific coordinate axes. This replaces the three boolean arguments previously passed to.set_principal_angular_inertia.
Breaking changes
Breaking changes related to contacts:
- The way contacts are represented changed. Refer to the documentation of
parry::query::ContactManifold,parry::query::TrackedContactandrapier::geometry::ContactManifoldDataandrapier::geometry::ContactDatafor details.
Breaking changes related to rigid-bodies:
- The
RigidBodyDesc.setMasstakes only one argument now. UseRigidBodyDesc.lockTranslationsto lock the translational motion of the rigid-body. - The
RigidBodyDesc.setPrincipalAngularInertiano longer have boolean parameters to lock rotations. UseRigidBodyDesc.lockRotationsorRigidBodyDesc.restrictRotationsto lock the rotational motion of the rigid-body.
Breaking changes related to colliders:
- The collider shape type has been renamed from
ColliderShapetoSharedShape(now part of the Parry crate). - The
Polygonshape no longer exists. For a 2D convex polygon, use aConvexPolygoninstead. - All occurrences of
Trimeshhave been replaced byTriMesh(note the change in case).
Breaking changes related to events:
- Rename all occurrences of
ProximitytoIntersection. - The
Proximityenum has been removed, it's replaced by a boolean.
v0.4.2
- Fix a bug in angular inertia tensor computation that could cause rotations not to work properly.
- Add
RigidBody::set_mass_propertiesto set the mass properties of an already-constructed rigid-body.
v0.4.1
- The
RigidBodyBuilder::principal_inertiamethod has been deprecated and renamed toprincipal_angular_inertiafor clarity.
v0.4.0
- The rigid-body
linvel,angvel, andpositionfields 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.
Locking translation and rotations of a rigid-body
- Add
RigidBodyBuilder::lock_rotationsto prevent a rigid-body from rotating because of forces. - Add
RigidBodyBuilder::lock_translationsto prevent a rigid-body from translating because of forces. - Add
RigidBodyBuilder::principal_inertiafor setting the principal inertia of a rigid-body, and/or preventing the rigid-body from rotating along a specific axis. - Change
RigidBodyBuilder::massby adding a bool parameter indicating whether or not the collider contributions should be taken into account in the future too.
Reading contact and proximity information
- Add
NarrowPhase::contacts_withandNarrowPhase::proximities_withto retrieve all the contact pairs and proximity pairs involving a specific collider. - Add
NarrowPhase::contact_pairandNarrowPhase::proximity_pairto retrieve one specific contact pair or proximity pair if it exists. - Add
NarrowPhase::contact_pairs, andNarrowPhase::proximity_pairsto retrieve all the contact or proximity pairs detected by the narrow-phase.
v0.3.2
- Add linear and angular damping. The damping factor can be set with
RigidBodyBuilder::linear_dampingandRigidBodyBuilder::angular_damping. - Implement
Clonefor almost everything that can be worth cloning. - Allow setting the initial mass and mass properties of a rigid-bodies using
RigidBodyBuilder::massandRigidBodyBuilder::mass_properties. - The restitution coefficient of colliders is now taken into account by the physics solver.
v0.3.1
- Fix non-determinism problem when using triangle-meshes, cone, cylinders, or capsules.
- Add
JointSet::remove(...)to remove a joint from theJointSet.
v0.3.0
- Collider shapes are now trait-objects instead of a
Shapeenum. - Add a user-defined
u128to each colliders and rigid-bodies for storing user data. - Add the support for
Cylinder,RoundCylinder, andConeshapes. - 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_groupsis used for filtering what pair of colliders should have their contacts computed by the narrow-phase. Theirsolver_groupsis 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
ContactPairFilterandProximityPairFilterthat allows user-defined logic for determining if two colliders/sensors are allowed to interact. - The
PhysicsPipeline::stepmethod now takes two additional arguments: the optional&ContactPairFilterand&ProximityPairFilterfor filtering contact and proximity pairs.
v0.2.1
- Fix panic in TriMesh construction and QueryPipeline update caused by a stack overflow or a subtraction underflow.
v0.2.0
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_bodybyRigidBodySet::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.