From 716c343979cedd7ddbcdc4e7c86d085b3d14f45d Mon Sep 17 00:00:00 2001 From: DasEtwas <18222134+DasEtwas@users.noreply.github.com> Date: Tue, 13 Apr 2021 01:39:25 +0200 Subject: Add #[must_use] to builders, expose more fields --- src/dynamics/rigid_body.rs | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'src/dynamics') diff --git a/src/dynamics/rigid_body.rs b/src/dynamics/rigid_body.rs index 824ec92..1fb7213 100644 --- a/src/dynamics/rigid_body.rs +++ b/src/dynamics/rigid_body.rs @@ -564,21 +564,23 @@ impl RigidBody { } /// A builder for rigid-bodies. +#[derive(Copy, Clone, Debug, PartialEq)] +#[must_use = "Builder functions return the updated builder"] pub struct RigidBodyBuilder { - position: Isometry, - linvel: Vector, - angvel: AngVector, - gravity_scale: Real, - linear_damping: Real, - angular_damping: Real, - rb_type: RigidBodyType, - mprops_flags: RigidBodyMassPropsFlags, - mass_properties: MassProperties, - can_sleep: bool, - sleeping: bool, - ccd_enabled: bool, - dominance_group: i8, - user_data: u128, + pub position: Isometry, + pub linvel: Vector, + pub angvel: AngVector, + pub gravity_scale: Real, + pub linear_damping: Real, + pub angular_damping: Real, + pub rb_type: RigidBodyType, + pub mprops_flags: RigidBodyMassPropsFlags, + pub mass_properties: MassProperties, + pub can_sleep: bool, + pub sleeping: bool, + pub ccd_enabled: bool, + pub dominance_group: i8, + pub user_data: u128, } impl RigidBodyBuilder { -- cgit From 2817fb0acb7a29626c32bffa3b0f564cc4b909a1 Mon Sep 17 00:00:00 2001 From: DasEtwas <18222134+DasEtwas@users.noreply.github.com> Date: Tue, 13 Apr 2021 02:09:18 +0200 Subject: Added documentation to newly public fields derived from setters --- src/dynamics/rigid_body.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/dynamics') diff --git a/src/dynamics/rigid_body.rs b/src/dynamics/rigid_body.rs index 1fb7213..d35fc54 100644 --- a/src/dynamics/rigid_body.rs +++ b/src/dynamics/rigid_body.rs @@ -567,19 +567,31 @@ impl RigidBody { #[derive(Copy, Clone, Debug, PartialEq)] #[must_use = "Builder functions return the updated builder"] pub struct RigidBodyBuilder { + /// The initial position of the rigid-body to be built. pub position: Isometry, + /// The linear velocity of the rigid-body to be built. pub linvel: Vector, + /// The angular velocity of the rigid-body to be built. pub angvel: AngVector, + /// The scale factor applied to the gravity affecting the rigid-body to be built, `1.0` by default. pub gravity_scale: Real, + /// Damping factor for gradually slowing down the translational motion of the rigid-body, `0.0` by default. 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, - pub rb_type: RigidBodyType, - pub mprops_flags: RigidBodyMassPropsFlags, + rb_type: RigidBodyType, + mprops_flags: RigidBodyMassPropsFlags, + /// The additional mass properties of the rigid-body being built. See [`RigidBodyBuilder::additional_mass_properties`] for more information. pub mass_properties: MassProperties, + /// Whether or not the rigid-body to be created can sleep if it reaches a dynamic equilibrium. pub can_sleep: bool, + /// Whether or not the rigid-body is to be created asleep. pub sleeping: bool, + /// Whether continuous collision-detection is enabled for the rigid-body to be built. pub ccd_enabled: bool, + /// The dominance group of the rigid-body to be built. pub dominance_group: i8, + /// An arbitrary user-defined 128-bit integer associated to the rigid-bodies built by this builder. pub user_data: u128, } @@ -838,7 +850,7 @@ impl RigidBodyBuilder { self } - /// Enabled continuous collision-detection for this rigid-body. + /// Sets whether or not continuous collision-detection is enabled for this rigid-body. pub fn ccd_enabled(mut self, enabled: bool) -> Self { self.ccd_enabled = enabled; self -- cgit From 810c39d427d277a601d517e7119c6b67e6c33376 Mon Sep 17 00:00:00 2001 From: DasEtwas <18222134+DasEtwas@users.noreply.github.com> Date: Thu, 6 May 2021 22:39:55 +0200 Subject: Remove Copy from RigidBodyBuilder --- src/dynamics/rigid_body.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/dynamics') diff --git a/src/dynamics/rigid_body.rs b/src/dynamics/rigid_body.rs index d35fc54..086f23d 100644 --- a/src/dynamics/rigid_body.rs +++ b/src/dynamics/rigid_body.rs @@ -564,7 +564,7 @@ impl RigidBody { } /// A builder for rigid-bodies. -#[derive(Copy, Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq)] #[must_use = "Builder functions return the updated builder"] pub struct RigidBodyBuilder { /// The initial position of the rigid-body to be built. -- cgit