feat: impl Default for RigidBodyBuilder and ColliderBuilder
This commit is contained in:
committed by
Sébastien Crozet
parent
c785ea4996
commit
5922612ef3
@@ -1134,7 +1134,8 @@ pub struct RigidBodyBuilder {
|
|||||||
pub linear_damping: Real,
|
pub linear_damping: Real,
|
||||||
/// Damping factor for gradually slowing down the angular motion of the rigid-body, `0.0` by default.
|
/// Damping factor for gradually slowing down the angular motion of the rigid-body, `0.0` by default.
|
||||||
pub angular_damping: Real,
|
pub angular_damping: Real,
|
||||||
body_type: RigidBodyType,
|
/// The type of rigid-body being constructed.
|
||||||
|
pub body_type: RigidBodyType,
|
||||||
mprops_flags: LockedAxes,
|
mprops_flags: LockedAxes,
|
||||||
/// The additional mass-properties of the rigid-body being built. See [`RigidBodyBuilder::additional_mass_properties`] for more information.
|
/// The additional mass-properties of the rigid-body being built. See [`RigidBodyBuilder::additional_mass_properties`] for more information.
|
||||||
additional_mass_properties: RigidBodyAdditionalMassProps,
|
additional_mass_properties: RigidBodyAdditionalMassProps,
|
||||||
@@ -1170,6 +1171,12 @@ pub struct RigidBodyBuilder {
|
|||||||
pub additional_solver_iterations: usize,
|
pub additional_solver_iterations: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for RigidBodyBuilder {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::dynamic()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl RigidBodyBuilder {
|
impl RigidBodyBuilder {
|
||||||
/// Initialize a new builder for a rigid body which is either fixed, dynamic, or kinematic.
|
/// Initialize a new builder for a rigid body which is either fixed, dynamic, or kinematic.
|
||||||
pub fn new(body_type: RigidBodyType) -> Self {
|
pub fn new(body_type: RigidBodyType) -> Self {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ use parry::shape::{Shape, TriMeshFlags};
|
|||||||
use crate::geometry::HeightFieldFlags;
|
use crate::geometry::HeightFieldFlags;
|
||||||
|
|
||||||
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
#[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.
|
/// 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.
|
/// To build a new collider, use the [`ColliderBuilder`] structure.
|
||||||
@@ -527,6 +527,12 @@ pub struct ColliderBuilder {
|
|||||||
pub contact_skin: Real,
|
pub contact_skin: Real,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for ColliderBuilder {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::ball(0.5)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl ColliderBuilder {
|
impl ColliderBuilder {
|
||||||
/// Initialize a new collider builder with the given shape.
|
/// Initialize a new collider builder with the given shape.
|
||||||
pub fn new(shape: SharedShape) -> Self {
|
pub fn new(shape: SharedShape) -> Self {
|
||||||
|
|||||||
Reference in New Issue
Block a user