- Package tree shaking has been disabled to avoid a crash on certain build configuration (#289).
- Update from the rust library of rapier 0.19 to 0.22, see rapier's changelog for more context.
- Added
RigidBody.userForce
function to retrieve the constant force(s) the user added to a rigid-body - Added
RigidBody.userTorque
function to retrieve the constant torque(s) the user added to a rigid-body
- Fix regression that could cause missed contact between a ball and another shape type.
Several stability improvements are added as part of this release. See rapier#625 for overviews of the most important improvements.
- The
castShape
andcastCollider
functions have been modified to add atargetDistance
parameter. This parameter indicates the distance below which a hit is detected. - Rename
RayIntersection.toi
to.timeOfImpact
for better clarity. - Rename
RayColliderIntersection.toi
to.timeOfImpact
for better clarity. - Rename
RayColliderToi
toRayColliderHit
. - Rename
RayColliderHit.toi
to.timeOfImpact
for better clarity. - Rename
ShapeTOI
toShapeCastHit
. - Rename
ShapeColliderTOI
toColliderShapeCastHit
. - Rename
ShapeCastHit.toi
to.timeOfImpact
.
- Fix the kinematic character controller getting stuck against vertical walls.
- Add
KinematicCharacterController.normalNudgeFactor
and.setNormalNudgeFactor
so set a coefficient used for avoiding having the character controller get stuck on penetrations. - Add
RigidBody.softCcdPrediction
,.setSoftCcdPrediction
, andRigidBodyDesc.setSoftCcdPrediction
for configuring soft-ccd on the rigid-body. See rapier#625 for additional details on soft-ccd. - 3D version only: add
TriMeshFlags::FIX_INTERNAL_EDGES
andHeightFieldFlags::FIX_INTERNAL_EDGES
for enabling internal edges correction (which is no longer enabled by default). The flags have been added as an optional parameter when building the shapes. - Add
Collider.contactSkin
,.setContactSkin
, andColliderDesc.setContactSkin
for configuring the collider’s contact skin. See rapier#625 for additional details on contact skins. - Add
World.lengthUnit
which can be used to indicate the typical size of dynamic objects (e.g. 100 pixels instead of 1 meter). This helps the physics engine adjust internal thresholds for better results.
- Fix an issue where the reported contact force are lower than their actual value.
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 World.numSolverIterations
.
If recovering the old solver behavior is useful to you, call World.switchToStandardPgsSolver()
.
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): RigidBodyDesc.additionalSolverIterations
and
RigidBody::setAdditionalSolverIterations
. This allows for higher-accuracy on subsets of the physics scene
without affecting performance of the other parts of the simulation.
- Renamed
CharacterController.translationApplied
,.translationRemaining
and thedesiredTranslation
method argument toCharacterController.translationDeltaApplied
,.translationDeltaRemaining
and thedesiredTranslationDelta
to avoid confusion with the usage of thetranslation
world inRigidBody.translation()
.
- Added
DynamicRayCastVehicleController
to simulate vehicles based on ray-casting. - Added
JointData.generic
(3D only) to create a generic 6-dof joint and manually specify the locked axes.
- Fix bug that made dynamic rigid-bodies behave like kinematic bodies after being disabled and then re-enabled.
- 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.
- Add
JointData.spring
andJointData.rope
joints. - Add access to the mass-properties of a rigid-body:
RigidBody.effectiveInvMass
,.invMass()
,.localCom()
,.worldCom()
,.invPrincipalInertiaSqrt()
,.principalInertia()
,.principalInertiaLocalFrame()
,.effectiveWorldInvInertiaSqrt()
,.effectiveAngularInertia()
. - Add
DynamicRayCastVehicleController.siteFrictionStiffness
to customize the side friction applied to the vehicle controller’s wheel.
- Rename
World.contactsWith
toWorld.contactPairsWith
. - Rename
World.intersectionsWith
toWorld.intersectionPairsWith
.
- Fix bug that disabled all colliders at construction time.
- Add
World.propagateModifiedBodyPositionsToColliders
to propagate rigid-bodies position changes to their attached colliders. - Add
World.updateSceneQueries
to update the scene queries data structures without stepping the whole simulation. - Add
RigidBody.isEnabled, RigidBody.setEnabled, RigidBodyDesc.setEnabled
to disable a rigid-body (and all its attached colliders) without removing it from the physics world. - Add
Collider.isEnabled, Collider.setEnabled, ColliderDesc.setEnabled
to disable a collider without removing it from the physics world. - Add shape-specific methods to modify a collider’s
size:
Collider.setRadius, setHalfExtents, setRoundRadius, setHalfHeight
.
- Add a boolean argument to
RigidBody.setBodyType
to indicate if the rigid-body should awaken after changing its type.
- Fix rigid-bodies automatically waking up at creation even if they were explicitly created sleeping.
- Add
World.createCharacterController
,World.removeCharacterController
to create/remove a kinematic character controller. - Add a character-controller implementation with the
KinematicCharacterController
class and its methodKinematicCharacterController.computeColliderMovement
. The character controller features currently supported are:- 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.
- Add the
HalfSpace
(infinite plane) shape. Colliders with this shape can be built usingColliderDesc.halfspace
.
- Change the signature of
Collider.castShape
and World.castShape by adding a boolean argumentstop_at_penetration
before the filter-related arguments. Set this argument totrue
to get the same result as before. If this is set tofalse
and the shape being cast starts it path already intersecting another shape, then a hit won’t be returned with that intersecting shape unless the casting movement would result in more penetrations. - Reduce rounding errors in 3D when setting the rotation of a rigid-body or collider.
- Fix incorrect application of torque if the torque is applies right after setting the rigid-body’s
position, but before calling
World.step
.
- 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).
- The
RigidBodyDesc.setAdditionalMass
method will now result in the additional angular inertia being automatically computed based on the shapes of the colliders attached to the rigid-body. - Removed the method
RigidBodyDesc.setAdditionalPrincipalAngularInertia
. UseRigidBodyDesc.setAdditionalMassProperties
instead. - The methods of
RigidBodyDesc
andColliderDesc
will now always copy the object provided by the user instead of storing the object itself. - The following method will now copy the user’s objects instead of storing it:
ColliderDesc.setRotation
,ColliderDesc.setMassProperties
,RigidBodyDesc.setRotation
,RigidBodyDesc.setAdditionalMassProperties
,RigidBodyDesc.setAngvel
. - Rename
RigidBody.restrictRotations
andRigidBody.restrictTranslations
toRigidBody.setEnabledRotations
andRigidBody.setEnabledTranslations
. - Rename
RigidBodyDesc.restrictRotations
andRigidBodyDesc.restrictTranslations
toRigidBodyDesc.enabledRotations
andRigidBodyDesc.enabledTranslations
.
- Add
ImpulseJoint.setContactsEnabled
, andMultibodyJoint.setContactsEnabled
to set whether contacts are enabled between colliders attached to rigid-bodies linked by this joint. - Add
UnitImpulseJoint.setLimits
to set the limits of a unit joint. - Add
RigidBody.recomputeMassPropertiesFromColliders
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::setAdditionalMass
to set the additional mass for the rigid-body. The additional angular inertia is automatically computed based on the attached colliders shapes. If this automatic angular inertia computation isn’t desired, useRigidBody::setAdditionalMassProperties
instead. - Add
Collider.setDensity
,.setMass
,.setMassProperties
, to alter a collider’s mass properties. Note that.setMass
will result in the collider’s angular inertia being automatically computed based on this mass and on its shape. - Add
ColliderDesc.setMass
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 more filtering options for scene-queries. All the scene query methods now take additional optional arguments to indicate if one particular collider, rigid-body, or type of colliders/rigid-bodies have to be ignored by the query.
- Add force reporting based on contact force events. The
EventHandler
trait has been modified to include the methodEventQueue.drainContactForceEvents
. Contact force events are generated whenever the sum of the magnitudes of all the forces between two colliders is greater than any of theirCollider.contactForceEventThreshold
values (only the colliders with theActiveEvents.CONTACT_FORCE_EVENT
flag set are taken into account for this threshold).
Starting with this release, all the examples in testbed2d
and testbed3d
have been updated to webpack 5
,
and are written in Typescript. In addition, canary 0.0.0
releases will be generated automatically after each merge
to the master
branch.
- Fix bug causing
World.intersectionPair
to always returnfalse
.
- Most APIs that relied on rigid-body handles or collider handles have been modified to rely on
RigidBody
orCollider
objects instead. Handles are now only needed for events and hooks. - Rename STATIC to FIXED in the
ActiveCollisionTypes
flags. - The
RigidBody.applyForce
and.applyTorque
methods have been replaced by.addForce
and.addTorque
. These force/torques are no longer automatically zeroed after a timestep. To zero them manually, call.resetForce
or.resetTorque
. - The
EventQueue.drainContactEvents
andEventQueue.drainIntersectionEvents
have been merged into a single method:EventQueue:drainCollisionEvents
.
- Add a lines-based debug-renderer. See #119 for examples of
integration of the debug-renderer with
THREE.js
andPIXI.js
. - Each rigid-body, collider, impulse joint, and multibody joint now have a unique object instance. This instance
in only valid as long as the corresponding objects is inserted to the
World
. - Add a
wakeUp: bool
argument to theWorld.createImpulseJoint
andMultibodyJointSet::createMultibodyJoint
to automatically wake-up the rigid-bodies attached to the inserted joint. - Add a
filter
callback to all the scene queries. Use this for filtering more fine-grained than collision groups. - Add
collider.shape
that represents the shape of a collider. This is a more convenient way of reading the collider’s shape properties. Modifying this shape will have no effect unlesscollider.setShape
is called with the modified shape. - Add
Collider.containsPoint
,.projectPoint
,.intersectsRay
,.castShape
,.castCollider
,.intersectsShape
,.contactShape
,.contactCollider
,.castRay
,.castRayAndGetNormal
. - Add
Shape.containsPoint
,.projectPoint
,.intersectsRay
,.castShape
,.intersectsShape
,.contactShape
,.castRay
,.castRayAndGetNormal
. - Add
World.projectPointAndGetFeature
which includes the feature Id the projected point lies on. - Add
RigidBodyDesc.sleeping
to initialize the rigid-body in a sleeping state.
The changelog hasn’t been updated yet. For an overview of the changes, refer to the changelog for the unreleased Rust version: https://github.com/dimforge/rapier/blob/master/CHANGELOG.md#unreleased
- Fix a crash when calling
collider.setShape
. - Fix a crash when calling
world.collidersWithAabbIntersectingAabb
. - Fix damping not being applied properly to some rigid-bodies.
This release updates to Rapier 0.12.0-alpha.0 which contains:
- A complete rewrite of the joint and contact constraint solver.
- The support for locking individual translation axes.
- The support for multibody joint.
This is an alpha release because the new solver still needs some tuning, and the spherical joint motors/limits is currently not working.
- In 3D: renamed
BallJoint
toSphericalJoint
. - In 2D: renamed
BallJoint
toRevoluteJoint
. - Remove the joint motors and limits for the spherical joint (this is a temporary removal until with leave alpha).
- All the joint-related structures and methods (
RevoluteJoint
,PrismaticJoint
,createJoint
, etc.) have renamed to includeimpulse
in the names:RevoluteImpulseJoint
,PrismaticImpulseJoint
,createImpulseJoint
, etc. This is to differentiate them from the new multibody joints. - Remove from the integration parameters all the parameters that are no longer meaningful (
maxPositionIterations
,jointErp
,warmstartCoeff
,allowedAngularError
,maxLinearCorrection
,maxAngularCorrection
).
- Add multibody joints. They are created the same way as impulse joints, except that they are created
by
world.createMultibodyJoint
instead ofworld.createImpulseJoint
. - Add the ability to lock individual translation axes. Use
rigidBody.restrictTranslation
.
- Fixed an issue with velocity-based kinematic bodies applying kinematic rotation improperly.
- Fixed the second witness points and normals returned by shape-casts.
- Fixed the second local contact normal and points returned by contact manifolds.
This release updates to Rapier 0.11.1 which contains several bug fixes.
- 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.
- Fixed an issue where a collider with no parent attached would not be created under some conditions.
This release was broken and has been unpublished.
- The
collider.halfExtents()
methods now returns a valid value for round cuboids.
- The
rapier-compat
packages don’t need theBuffer
polyfill anymore.
- Update to use Rapier 0.11.0.
- The
rapier-compat
packages are now generated by rollup.
The typescripts bindings for Rapier have a brand new user-guide covering all the features of the physics engine!
- The
World.castRay
andWorld.castRayAndGetNormal
methods have a different signature now, making them more flexible. - Rename
ActiveHooks::FILTER_CONTACT_PAIR
toActiveHooks.FILTER_CONTACT_PAIRS
. - Rename
ActiveHooks::FILTER_INTERSECTION_PAIR
toActiveHooks.FILTER_INTERSECTION_PAIRS
. - Rename
BodyStatus
toRigidBodyType
. - Rename
RigidBody.bodyStatus()
toRigidBody.bodyType()
. - Rename
RigidBodyDesc.setMassProperties
toRigidBodyDesc.setAdditionalMassProperties
. - Rename
RigidBodyDesc.setPrincipalAngularInertia
toRigidBodyDesc.setAdditionalPrincipalAngularInertia
. - Rename
ColliderDesc.setIsSensor
to `ColliderDesc.setSensor.
- Add
Ray.pointAt(t)
that conveniently computesray.origin + ray.dir * t
. - Add access to joint motors by defining each joint with its own class deriving from
Joint
. Each joint now have its relevant motor configuration methods:configurMotorModel, configureMotorVelocity, configureMotorPosition, configureMotor
. - Add
World.collidersWithAabbIntersectingAabb
for retrieving the handles of all the colliders intersecting the given AABB. - Add many missing methods for reading/modifying a rigid-body state after its creation:
RigidBody.lockTranslations
RigidBody.lockRotations
RigidBody.restrictRotations
RigidBody.dominanceGroup
RigidBody.setDominanceGroup
RigidBody.enableCcd
- Add
RigidBodyDesc.setDominanceGroup
for setting the dominance group of the rigid-body being built. - Add many missing methods for reading/modifying a collider state after its creation:
Collider.setSendor
Collider.setShape
Collider.setRestitution
Collider.setFriction
Collider.frictionCombineRule
Collider.setFrictionCombineRule
Collider.restitutionCombineRule
Collider.setRestitutionCombineRule
Collider.setCollisionGroups
Collider.setSolverGroups
Collider.activeHooks
Collider.setActiveHooks
Collider.activeEvents
Collider.setActiveEvents
Collider.activeCollisionTypes
Collider.setTranslation
Collider.setTranslationWrtParent
Collider.setRotation
Collider.setRotationWrtParent
- Add
ColliderDesc.setMassProperties
for setting explicitly the mass properties of the collider being built (instead of relying on density).
- Colliders are no longer required to be attached to a rigid-body. Therefore, the second argument
of
World.createCollider
is now optional.
- The
BodyStatus::Kinematic
variant has been replaced byBodyStatus::KinematicPositionBased
andBodyStatus::KinematicVelocityBased
. Position-based kinematic bodies are controlled by setting (at each frame) the next kinematic position of the rigid-body (just like before), and the velocity-based kinematic bodies are controlled by setting (at each frame) the velocity of the rigid-body. - The
RigidBodyDesc.newKinematic
has been replaced byRigidBodyDesc.newKinematicPositionBased
andRigidBodyDesc.newKinematicVelocityBased
in order to build a position-based or velocity-based kinematic body. - All contact and intersection events are now disabled by default. The can be enabled for each collider individually
by setting
its
ActiveEvents
:ColliderDesc.setActiveEvents(ActiveEvents.PROXIMITY_EVENTS | ActiveEvents.ContactEvents)
.
- It is now possible to read contact information from the narrow-phase using:
world.narrowPhase.contactsWith(collider1, callback)
world.narrowPhase.intersectionsWith(collider1, callback)
world.narrowPhase.contactPair(collider1, collider2, callback)
world.narrowPhase.intersectionPair(collider1, collider2, callback)
- It is now possible to apply custom collision-detection filtering rules (more flexible than collision groups)
based on a JS object by doing the following:
- Enable physics hooks for the colliders you want the custom rules to apply to:
ColliderDesc.setActiveHooks(ActiveHooks.FILTER_CONTACT_PAIR | ActiveHooks.FILTER_CONTACT_PAIR)
- Define an object that implements the
PhysicsHooks
interface. - Pass and instance of your physics hooks object as the second argument of the
World.step
method.
- Enable physics hooks for the colliders you want the custom rules to apply to:
- It is now possible to enable collision-detection between two non-dynamic bodies (e.g. between a kinematic
body and a fixed body) by setting the active collision types of a collider:
ColliderDesc.setActiveCollisionTypes(ActiveCollisionTypes.ALL)
- Fix a crash when loading the WASM file on iOS safari.
- Fix a crash that could happen after adding and then removing a collider right away, before stepping the simulation.
- Fix a determinism issue after snapshot restoration.
- Significantly improve the broad-phase performances when very large colliders are used.
- Add
RigidBodyDesc::setCcdEnabled
to enable Continuous Collision Detection (CCD) for this rigid-body. CCD ensures that a fast-moving rigid-body doesn't miss a collision (the tunneling problem).
- Removed multiple fields from
IntegrationParameters
. These were unused parameters.
- Fix a bug in ball/convex shape collision detection causing the ball to ignore penetrations with depths greater than its radius.
Breaking changes:
- Removed
IntegrationParameters.restitutionVelocityThreshold
andIntegrationParameters.set_restitutionVelocityThreshold
.
- Fix crash happening when creating a collider with a
ColliderDesc.convexHull
shape. - Actually remove the second argument of
RigidBodyDesc.setMass
as mentioned in the 0.3.0 changelog. - Improve snapshotting performances.
- 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 (the same methods have been added to the
QueryPipeline
too):
World.intersectionsWithRay
: get all colliders intersecting a ray.World.intersectionWithShape
: get one collider intersecting a shape.World.projectPoint
: get the projection of a point on the closest collider.World.intersectionsWithPoint
: get all the colliders containing a point.World.castShape
: get the first collider intersecting a shape moving linearly (aka. sweep test).World.intersectionsWithShape
: 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:
ColliderDesc.roundCuboid
,ColliderDesc.segment
,ColliderDesc.triangle
,ColliderDesc.roundTriangle
,ColliderDesc.convexHull
,ColliderDesc.roundConvexHull
,ColliderDesc.Polyline
,ColliderDesc.convexPolyline
(2D only),ColliderDesc.roundConvexPolyline
(2D only),ColliderDesc.convexMesh
(3D only),ColliderDesc.roundConvexMesh
(3D only),ColliderDesc.roundCone
(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.frictionCombineRule
, andColliderDesc.restitutionCombineRule
.
Various RigidBody-related getter and setters have been added:
RigidBodyDesc.newStatic
,RigidBodyDesc.newDynamic
, andRigidBodyDesc.newKinematic
are new static method, short equivalent tonew RigidBodyDesc(BodyStatus.Static)
, etc.RigidBodyDesc.setGravityScale
,RigidBody.gravityScale
,RigidBody.setGravityScale
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.setLinearDamping
andRigidBody.setAngularDamping
to set the linear and angular damping of the rigid-body.RigidBodyDesc.restrictRotations
to prevent rotations along specific coordinate axes. This replaces the three boolean arguments previously passed to.setPrincipalAngularInertia
.
Breaking changes related to rigid-bodies:
- The
RigidBodyDesc.setTranslation
andRigidBodyDesc.setLinvel
methods now take the components of the translation directly as arguments instead of a singleVector
. - 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
ColliderDesc.setTranslation
method now take the components of the translation directly as arguments instead of a singleVector
. - The
roundRadius
fields have been renamedborderRadius
. - The
RawShapeType.Polygon
no longer exists. For a 2D convex polygon, useRawShapeType.ConvexPolygon
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. - The
drainIntersectionEvents
(previously calleddrainProximityEvent
) will now call a callback with arguments(number, number, boolean)
: two collider handles, and a boolean indicating if they are intersecting.
Breaking changes related to scene queries:
- The
QueryPipeline.castRay
method now takes two additional parameters: a boolean indicating if the ray should not propagate if it starts inside of a shape, and a bit mask indicating the group the ray is part of and these it interacts with. - The
World.castRay
andQueryPipeline.castRay
now return a struct of typeRayColliderHit
which no longer contains the normal at the hit point. Use the new methodsWorld.castRayAndGetNormal
orQueryPipeline.castRayAndGetNormal
in order to retrieve the normal too.
- Fix a bug where
RigidBodyDesc.setMass(m)
withm != 0.0
would cause the rotations of the created rigid-body to be locked.
- Add a boolean argument to
RigidBodyDesc.setMass
to indicate if the mass contribution of colliders should be enabled for this rigid-body or not. - Add a
RigidBody.lockRotations
method to lock all the rigid-body rotations resulting from forces. - Add a
RigidBody.lockTranslations
method to lock all the rigid-body translations resulting from forces. - Add a
RigidBody.setPrincipalAngularInertia
method to set the principal inertia of the rigid-body. This gives the ability to lock individual rotation axes of one rigid-body.
- Fix a bug where removing when immediately adding a collider would cause collisions to fail with the new collider.
- Fix a regression causing some colliders added after a few timesteps not to be properly taken into account.
- Fix a bug where removing a collider would result in a rigid-body being removed instead.
- Fix a determinism issue when running simulation on the Apple M1 processor.
- Add
JointData.prismatic
andJointData.fixed
for creating prismatic joint or fixed joints.
- Add
RigidBody.setLinvel
to set the linear velocity of a rigid-body. - Add
RigidBody.setAngvel
to set the angular velocity of a rigid-body.
- Add
RigidBodySet.remove
to remove a rigid-body from the set. - Add
ColliderSet.remove
to remove a collider from the set. - Add
JointSet.remove
to remove a joint from the set. - Add
RigidBodyDesc.setLinearDamping
andRigidBodyDesc.setAngularDamping
for setting the linear and angular damping coefficient of the rigid-body to create. - Add
RigidBodyDesc.setMass
, andRigidBodyDesc.setMassProperties
for setting the initial mass properties of a rigid-body. - Add
ColliderDesc.setCollisionGroups
to use bit-masks for collision filtering between some pairs of colliders. - Add
ColliderDesc.setSolverGroups
to use bit-masks for making the constraints solver ignore contacts between some pairs of colliders. - Add
ColliderDesc.heightfield
to build a collider with an heightfield shape. - Add
ColliderDesc.trimesh
to build a collider with a triangle mesh shape.
- Reduce snapshot size and computation times.
- Fix bug causing an unbounded memory usage when an objects falls indefinitely.
- Fix wrong result given by
RigidBody.isKinematic()
andRigidBody.isDynamic()
.
- Add the support for round cylinder colliders (i.e. cylinders with round edges).
- Add the support for cone, cylinder, and capsule colliders.
- Fix regression causing the density and
isSensor
properties ofColliderDesc
to not be taken into account. - Throw an exception when the parent handle passed to
world.createCollider
is not a number.
This is a significant rewrite of the JavaScript bindings for rapier. The objective of this rewrite is to make the API closer to Rapier's and remove most need for manual memory management.
- Calling
.free()
is now required only for objects that live for the whole duration of the simulation. This means that it is no longer necessary to.free()
vectors, rays, ray intersections, colliders, rigid-bodies, etc. Object that continue to require an explicit.free()
are:World
andEventQueue
.- Or, if you are not using the
World
directly:RigidBodySet
,ColliderSet
,JointSet
,IntegrationParameters
,PhysicsPipeline
,QueryPipeline
,SerializationPipeline
, andEventQueue
.
- Collider.parent() now returns the
RigidBodyHandle
of its parent (instead of theRigidBody
directly). - Colliders are now built with
world.createCollider
, i.e.,body.createCollider(colliderDesc)
becomesworld.createCollider(colliderDesc, bodyHandle)
. - Shape types are not an enumeration instead of strings:
ShapeType.Ball
andShapeType.Cuboid
instead of"ball"
and"cuboid"
. collider.handle
is now a field instead of a function.body.handle
is now a field instead of a function.- The world's gravity is now a
Vector
instead of individual components, i.e.,let world = new RAPIER.World(x, y, z);
becomeslet world = new RAPIER.World(new RAPIER.Vector3(x, y, z))
. - Most methods that took individual components as argument (
setPosition
,setKinematicPosition
,setRotation
, etc.) now take aVector
orRotation
structure instead. For examplerigid_body.setKinematicPosition(x, y, z)
becomesrigid_body.setKinematicPosition(new RAPIER.Vector3(x, y, z))
. world.stepWithEvents
becomesworld.step
(the event queue is the last optional argument).RigidBodyDesc
andColliderDesc
now use the builder pattern. For examplelet bodyDesc = new RAPIER.RigidBodyDesc("dynamic"); bodyDesc.setTranslation(x, y, z)
becomesnew RigidBodyDesc(BodyStatus.Dynamic).setTranslation(new Vector(x, y, z))
.ray.dir
andray.origin
are now fields instead of methods.- 2D rotations are now just a
number
instead of aRotation
struct. So instead of doingrotation.angle
, single use the number as the rotation angle. - 3D rotations are now represented by the interface
Rotation
(with fields{x,y,z,w}
) or the classQuaternion
. Any object with these{x, y, z, w}
fields can be used wherever aRotation
is required. - 2D vectors are now represented by the interface
Vector
(with fields{x,y}
) or the classVector2
). Any object with these{x,y}
fields can be used wherever aVector
is required. - 3D vectors are now represented by the interface
Vector
(with fields{x,y,z}
) or the classVector3
). Any object with these{x,y,z}
fields can be used wherever aVector
is required.
See changelogs for v0.2.1 instead. The NPM package for v0.2.0 were missing some files.
- Fix bug when ghost forces and/or crashes could be observed when a kinematic body touches a fixed body.
- Fix kinematic rigid-body not waking up dynamic bodies it touches.
- Added
new Ray(origin, direction)
constructor instead ofRay.new(origin, direction)
.
- Fix crash when removing a kinematic rigid-body from the World.
- Fix issues where force application functions took ownership of the JS vector, preventing the user from freeing
with
Vector.free()
afterwards.
- Added
rigidBody.setNextKinematicTranslation
to set the translation of a kinematic rigid-body at the next timestep. - Added
rigidBody.setNextKinematicRotation
to set the rotation of a kinematic rigid-body at the next timestep. - Added
rigidBody.predictedTranslation
to get the translation of a kinematic rigid-body at the next timestep. - Added
rigidBody.predictedRotation
to set the rotation of a kinematic rigid-body at the next timestep. - Added
Ray
andRayIntersection
structures for ray-casting. - Added
world.castRay
to compute the first hit of a ray with the physics scene. - Fix a bug causing a kinematic rigid-body not to teleport as expected after a
rigidBody.setPosition
.
- Added
world.removeCollider(collider)
to remove a collider from the physics world. - Added
colliderDesc.setTranslation(...)
to set the relative translation of the collider to build wrt. the rigid-body it is attached to. - Added
colliderDesc.setRotation(...)
to set the relative rotation of the collider to build wrt. the rigid-body it is attached to.
- Fix a bug causing a crash when the broad-phase proxy handles were recycled.
- Fix a determinism problem that could cause rigid-body handle allocation to be non-deterministic after a snapshot restoration.
- Added
world.getCollider(handle)
that retrieves a collider from its integer handle. - Added
joint.handle()
that returns the integer handle of the joint.
- Added
world.forEachRigidBodyHandle(f)
to apply a closure on the integer handle of each rigid-body on the world. - Added
world.forEachActiveRigidBody(f)
to apply a closure on each rigid-body on the world. - Added
world.forEachActiveRigidBodyHandle(f)
to apply a closure on the integer handle of each rigid-body on the world. - Added
rigidBody.applyForce
,.applyTorque
,.applyImpulse
,.applyTorqueImpulse
,.applyForceAtPoint
, and.applyImpulseAtPoint
to apply a manual force or torque to a rigid-body. - Added the
EventQueue
structure that can be used to collect and iterate through physics events. - Added the
Proximity
enum that represents the proximity state of a sensor collider and another collider. - Added the
world.stepWithEvents(eventQueue)
which executes a physics timestep and collects the physics events into the given event queue.
- Added
world.getRigidBody(handle)
to retrieve a rigid-body from its handle. - Added
world.getJoint(handle)
to retrieve a joint from its handle. - Added
rigidBody.rotation()
to retrieve its world-space orientation as a quaternion. - Added
rigidBody.setTranslation(...)
to set the translation of a rigid-body. - Added
rigidBody.setRotation(...)
to set the orientation of a rigid-body. - Added
rigidBody.wakeUp()
to manually wake up a rigid-body. - Added
rigidBody_desc.setRotation(...)
to set tho orientation of the rigid-body to be created.
- Added
world.removeRigidBody(...)
to remove a rigid-body from the world.