diff options
| author | Sébastien Crozet <sebcrozet@dimforge.com> | 2024-05-26 18:13:10 +0200 |
|---|---|---|
| committer | Sébastien Crozet <sebastien@crozet.re> | 2024-06-09 12:09:58 +0200 |
| commit | 5922612ef31fc1e0de8f129a8415b995cc8e7268 (patch) | |
| tree | 04bdfbdb33ae20407a196b5e2180765b7b877cbc /src | |
| parent | c785ea49965aa151e942feb3da0fb4ba03768441 (diff) | |
| download | rapier-5922612ef31fc1e0de8f129a8415b995cc8e7268.tar.gz rapier-5922612ef31fc1e0de8f129a8415b995cc8e7268.tar.bz2 rapier-5922612ef31fc1e0de8f129a8415b995cc8e7268.zip | |
feat: impl Default for RigidBodyBuilder and ColliderBuilder
Diffstat (limited to 'src')
| -rw-r--r-- | src/dynamics/rigid_body.rs | 9 | ||||
| -rw-r--r-- | src/geometry/collider.rs | 8 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/dynamics/rigid_body.rs b/src/dynamics/rigid_body.rs index 25631fc..50c864c 100644 --- a/src/dynamics/rigid_body.rs +++ b/src/dynamics/rigid_body.rs @@ -1134,7 +1134,8 @@ pub struct RigidBodyBuilder { pub linear_damping: Real, /// Damping factor for gradually slowing down the angular motion of the rigid-body, `0.0` by default. pub angular_damping: Real, - body_type: RigidBodyType, + /// The type of rigid-body being constructed. + pub body_type: RigidBodyType, mprops_flags: LockedAxes, /// The additional mass-properties of the rigid-body being built. See [`RigidBodyBuilder::additional_mass_properties`] for more information. additional_mass_properties: RigidBodyAdditionalMassProps, @@ -1170,6 +1171,12 @@ pub struct RigidBodyBuilder { pub additional_solver_iterations: usize, } +impl Default for RigidBodyBuilder { + fn default() -> Self { + Self::dynamic() + } +} + impl RigidBodyBuilder { /// Initialize a new builder for a rigid body which is either fixed, dynamic, or kinematic. pub fn new(body_type: RigidBodyType) -> Self { diff --git a/src/geometry/collider.rs b/src/geometry/collider.rs index 565d6e2..c58548e 100644 --- a/src/geometry/collider.rs +++ b/src/geometry/collider.rs @@ -16,7 +16,7 @@ use parry::shape::{Shape, TriMeshFlags}; use crate::geometry::HeightFieldFlags; #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] -#[derive(Clone)] +#[derive(Clone, Debug)] /// A geometric entity that can be attached to a body so it can be affected by contacts and proximity queries. /// /// To build a new collider, use the [`ColliderBuilder`] structure. @@ -527,6 +527,12 @@ pub struct ColliderBuilder { pub contact_skin: Real, } +impl Default for ColliderBuilder { + fn default() -> Self { + Self::ball(0.5) + } +} + impl ColliderBuilder { /// Initialize a new collider builder with the given shape. pub fn new(shape: SharedShape) -> Self { |
