This month in Dimforge #6 (Apr. 2021 - May. 2021)

Welcome to the sixth edition of This month in Dimforge! This newsletter provides you with a summary of important updates that occurred within the Dimforge community. This includes in particular updates about the Rapier (physics engine), Salva (fluid simulation), Parry (collision-detection), nalgebra (linear algebra), and Simba (abstract algebra) crates. This sixth edition will contain updates for the months of April and May 2021.

Help us sustain this work by sponsoring us on GitHub sponsors
Join us on discord!

Announcing Rapier 0.9 + bevy_rapier 0.10 ⚔️

The release 0.9 was mostly focussed on improving the ergonomics of the crate by:

  • Allowing user-defined storages containing rigid-bodies and colliders in place of the default ColliderSet, RigidBodySet (which are still available). Actually the RigidBody and Collider structs can also be optionally replaced by a set of individual components (RigidBodyVelocity, RigidBodyPosition, ColliderShape, etc.) This can make the integration of Rapier into another framework much more ergonomic (bevy_rapier 0.10 is an example of improved integration).
  • Allowing colliders not attached to any rigid-body.
  • Adding a few simple methods to get/set the translation and rotation of a rigid-body or collider (instead of setting the whole isometry at once).
  • Adding an easy way to enable collision-detection between a collider attached to a kinematic rigid-body and a collider attached to a static rigid-body. More generally, we can now easily enable collision detection between two colliders attached to non-dynamic rigid-bodies by configuring their active collision types.
  • Adding velocity-based kinematic bodies. They are rigid-bodies controlled by setting their velocity instead of their next position.
  • Making collision events and physics hooks enabled for each individual collider explicitly instead of being enabled for all the colliders automatically. See the collider's active events and active hooks.

Check out the v0.9.0 changelog for an exhaustive list of the changes.

Completely rewritten bevy_rapier 0.10 🐦

Thanks to the support of user-defined storages in Rapier 0.9, we were able to rewrite our Rapier plugin for Bevy bevy_rapier 0.10 to make it significantly more ergonomic (giving it a more bevy-native feeling) than bevy_rapier 0.9.

As a result, Bevy's QuerySet are now used as rigid-body/collider storages instead of the RigidBodySet/ColliderSet. Rigid-bodies and collider are now defined as bundles (instead of the monolithic structs RigidBody and Collider):

#[derive(Bundle)]
pub struct RigidBodyBundle {
pub body_type: RigidBodyType,
pub position: RigidBodyPosition,
pub velocity: RigidBodyVelocity,
pub mass_properties: RigidBodyMassProps,
pub forces: RigidBodyForces,
pub activation: RigidBodyActivation,
pub damping: RigidBodyDamping,
pub dominance: RigidBodyDominance,
pub ccd: RigidBodyCcd,
pub changes: RigidBodyChanges,
pub ids: RigidBodyIds,
pub colliders: RigidBodyColliders,
}
#[derive(Bundle)]
pub struct ColliderBundle {
pub collider_type: ColliderType,
pub shape: ColliderShape,
pub position: ColliderPosition,
pub material: ColliderMaterial,
pub flags: ColliderFlags,
pub mass_properties: ColliderMassProps,
pub changes: ColliderChanges,
pub bf_data: ColliderBroadPhaseData,
}

The components in these bundles can be queried like any other components of Bevy.

New, complete, user-guides 📖

During the past two months we have also been working at making the documentation of Rapier and bevy-rapier much more complete! We now have user-guides that cover all the available features of Rapier, excepted details about implementing your own custom storage for colliders and rigid-bodies.

Check out the new Rapier user-guide and the new bevy-rapier user-guide. We haven't improved the JavaScript user-guide but we will work on it in June.

Rapier JavaScript bindings v0.6.0 🌐

The JavaScript bindings for Rapier have been updated to use Rapier 0.9.0. In addition, we added the ability to:

  • Create velocity-based kinematic bodies.
  • Read contact information (contact points, contact normals, etc.) and intersection statuses from the narrow-phase
  • Write custom filters (as JS objects implementing a specific interface) for applying any rule to select what pair of colliders can or cannot collide.

Check out the 0.6.0 changelog for a list of all the changes.

nalgebra v0.26 and v0.27: const-generics 🎊

In April, we released the version 0.26 of nalgebra with one major changed: we integrated const-generics. Check out our dedicated announcement if you missed it.

In nalgebra v0.27, we added (thanks to the contribution from Andreas Longva) the macros matrix!, dmatrix!, vector!, dvector!, point! for constructing matrices/vectors/points in a convenient way. The length of the matrix/vector/point is deduced automatically from the number of elements given to the macros:

use nalgebra::{vector, matrix};
let vec3 = vector![1.0, 2.0, 3.0]; // Constructs a `Vector3`.
let pt2 = point![1.0, 2.0]; // Constructs a `Point2`.
let mat2x3 = matrix![
11.0, 12.0, 13.0; // The ; delimits each row of the matrix.
21.0, 22.0, 23.0
]; // Constructs a `Matrix2x3`
let dvec = dvector![1.0, 2.0, 3.0, 4.0]; // Constructs a `DVector` with four elements.

The vector!, matrix! and point! macros can also be used in a const context:

const MY_VECTOR: Vector2<f32> = vector![1.0, 2.0];

What's next

At the beginning of this year, we announced our 2021 roadmap for Rapier. During the past two months, we slightly diverged from that roadmap because we figured it was time to make the library more accessible to the community by improving its API (especially for bevy_rapier) and by providing comprehensive docs. Hopefully, this will make game-development in Rust even more appealing to newcomers, and will allow everybody to use the more advanced features of Rapier (that were not documented at all before).

In May, we will continue on that path by rewriting/completing the user-guide for the JavaScript bindings of Rapier. If we have time after that, we will implement the joint limits we initially planned for last month (currently, only joint limits for prismatic bodies are implemented).


Thanks

We would like to thank the whole community and code contributors. In particular, thanks to the code contributors from the past two months1:

  • Thanks to users reporting spelling mistakes on the documentation. This is always appreciated.
  • Thanks to users joining us on our discord server to provide feedbacks, discuss features, and get assistance!

Finally, thanks to all the former, current and new supporters through GitHub sponsors! This help is greatly appreciated and allows us to continue working on our open-source projects.


  1. The list of contributors is automatically generated from the past two months' github commit history. Don't hesitate to let us know if your name should have been mentioned here.