Rename rigid-body static to fixed
This commit is contained in:
committed by
Sébastien Crozet
parent
db6a8c526d
commit
a9e3441ecd
@@ -412,7 +412,7 @@ impl CCDSolver {
|
||||
return PredictedImpacts::ImpactsAfterEndTime(min_overstep);
|
||||
}
|
||||
|
||||
// NOTE: all static bodies (and kinematic bodies?) should be considered as "frozen", this
|
||||
// NOTE: all fixed bodies (and kinematic bodies?) should be considered as "frozen", this
|
||||
// may avoid some resweeps.
|
||||
let mut pseudo_intersections_to_check = vec![];
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@ impl IslandManager {
|
||||
|
||||
if rb_ids.active_set_timestamp == self.active_set_timestamp || !rb_status.is_dynamic() {
|
||||
// We already visited this body and its neighbors.
|
||||
// Also, we don't propagate awake state through static bodies.
|
||||
// Also, we don't propagate awake state through fixed bodies.
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ impl RigidBody {
|
||||
self.changes.insert(RigidBodyChanges::TYPE);
|
||||
self.rb_type = status;
|
||||
|
||||
if status == RigidBodyType::Static {
|
||||
if status == RigidBodyType::Fixed {
|
||||
self.rb_vels = RigidBodyVelocity::zero();
|
||||
}
|
||||
}
|
||||
@@ -372,11 +372,11 @@ impl RigidBody {
|
||||
self.rb_type.is_kinematic()
|
||||
}
|
||||
|
||||
/// Is this rigid body static?
|
||||
/// Is this rigid body fixed?
|
||||
///
|
||||
/// A static body cannot move and is not affected by forces.
|
||||
pub fn is_static(&self) -> bool {
|
||||
self.rb_type == RigidBodyType::Static
|
||||
/// A fixed body cannot move and is not affected by forces.
|
||||
pub fn is_fixed(&self) -> bool {
|
||||
self.rb_type == RigidBodyType::Fixed
|
||||
}
|
||||
|
||||
/// The mass of this rigid body.
|
||||
@@ -487,7 +487,7 @@ impl RigidBody {
|
||||
/// Is this rigid body sleeping?
|
||||
pub fn is_sleeping(&self) -> bool {
|
||||
// TODO: should we:
|
||||
// - return false for static bodies.
|
||||
// - return false for fixed bodies.
|
||||
// - return true for non-sleeping dynamic bodies.
|
||||
// - return true only for kinematic bodies with non-zero velocity?
|
||||
self.rb_activation.sleeping
|
||||
@@ -531,7 +531,7 @@ impl RigidBody {
|
||||
RigidBodyType::KinematicVelocityBased => {
|
||||
self.rb_vels.linvel = linvel;
|
||||
}
|
||||
RigidBodyType::Static | RigidBodyType::KinematicPositionBased => {}
|
||||
RigidBodyType::Fixed | RigidBodyType::KinematicPositionBased => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -553,7 +553,7 @@ impl RigidBody {
|
||||
RigidBodyType::KinematicVelocityBased => {
|
||||
self.rb_vels.angvel = angvel;
|
||||
}
|
||||
RigidBodyType::Static | RigidBodyType::KinematicPositionBased => {}
|
||||
RigidBodyType::Fixed | RigidBodyType::KinematicPositionBased => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -575,7 +575,7 @@ impl RigidBody {
|
||||
RigidBodyType::KinematicVelocityBased => {
|
||||
self.rb_vels.angvel = angvel;
|
||||
}
|
||||
RigidBodyType::Static | RigidBodyType::KinematicPositionBased => {}
|
||||
RigidBodyType::Fixed | RigidBodyType::KinematicPositionBased => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -905,7 +905,7 @@ pub struct RigidBodyBuilder {
|
||||
}
|
||||
|
||||
impl RigidBodyBuilder {
|
||||
/// Initialize a new builder for a rigid body which is either static, dynamic, or kinematic.
|
||||
/// Initialize a new builder for a rigid body which is either fixed, dynamic, or kinematic.
|
||||
pub fn new(rb_type: RigidBodyType) -> Self {
|
||||
Self {
|
||||
position: Isometry::identity(),
|
||||
@@ -925,23 +925,39 @@ impl RigidBodyBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
/// Initializes the builder of a new static rigid body.
|
||||
/// Initializes the builder of a new fixed rigid body.
|
||||
#[deprecated(note = "use `RigidBodyBuilder::fixed()` instead")]
|
||||
pub fn new_static() -> Self {
|
||||
Self::new(RigidBodyType::Static)
|
||||
Self::fixed()
|
||||
}
|
||||
/// Initializes the builder of a new velocity-based kinematic rigid body.
|
||||
#[deprecated(note = "use `RigidBodyBuilder::kinematic_velocity_based()` instead")]
|
||||
pub fn new_kinematic_velocity_based() -> Self {
|
||||
Self::kinematic_velocity_based()
|
||||
}
|
||||
/// Initializes the builder of a new position-based kinematic rigid body.
|
||||
#[deprecated(note = "use `RigidBodyBuilder::kinematic_position_based()` instead")]
|
||||
pub fn new_kinematic_position_based() -> Self {
|
||||
Self::kinematic_position_based()
|
||||
}
|
||||
|
||||
/// Initializes the builder of a new kinematic rigid body.
|
||||
pub fn new_kinematic_velocity_based() -> Self {
|
||||
/// Initializes the builder of a new fixed rigid body.
|
||||
pub fn fixed() -> Self {
|
||||
Self::new(RigidBodyType::Fixed)
|
||||
}
|
||||
|
||||
/// Initializes the builder of a new velocity-based kinematic rigid body.
|
||||
pub fn kinematic_velocity_based() -> Self {
|
||||
Self::new(RigidBodyType::KinematicVelocityBased)
|
||||
}
|
||||
|
||||
/// Initializes the builder of a new kinematic rigid body.
|
||||
pub fn new_kinematic_position_based() -> Self {
|
||||
/// Initializes the builder of a new position-based kinematic rigid body.
|
||||
pub fn kinematic_position_based() -> Self {
|
||||
Self::new(RigidBodyType::KinematicPositionBased)
|
||||
}
|
||||
|
||||
/// Initializes the builder of a new dynamic rigid body.
|
||||
pub fn new_dynamic() -> Self {
|
||||
pub fn dynamic() -> Self {
|
||||
Self::new(RigidBodyType::Dynamic)
|
||||
}
|
||||
|
||||
|
||||
@@ -57,8 +57,8 @@ pub type BodyStatus = RigidBodyType;
|
||||
pub enum RigidBodyType {
|
||||
/// A `RigidBodyType::Dynamic` body can be affected by all external forces.
|
||||
Dynamic = 0,
|
||||
/// A `RigidBodyType::Static` body cannot be affected by external forces.
|
||||
Static = 1,
|
||||
/// A `RigidBodyType::Fixed` body cannot be affected by external forces.
|
||||
Fixed = 1,
|
||||
/// A `RigidBodyType::KinematicPositionBased` body cannot be affected by any external forces but can be controlled
|
||||
/// by the user at the position level while keeping realistic one-way interaction with dynamic bodies.
|
||||
///
|
||||
@@ -73,14 +73,14 @@ pub enum RigidBodyType {
|
||||
/// cannot be pushed by anything. In other words, the trajectory of a kinematic body can only be
|
||||
/// modified by the user and is independent from any contact or joint it is involved in.
|
||||
KinematicVelocityBased = 3,
|
||||
// Semikinematic, // A kinematic that performs automatic CCD with the static environment to avoid traversing it?
|
||||
// Semikinematic, // A kinematic that performs automatic CCD with the fixed environment to avoid traversing it?
|
||||
// Disabled,
|
||||
}
|
||||
|
||||
impl RigidBodyType {
|
||||
/// Is this rigid-body static (i.e. cannot move)?
|
||||
pub fn is_static(self) -> bool {
|
||||
self == RigidBodyType::Static
|
||||
/// Is this rigid-body fixed (i.e. cannot move)?
|
||||
pub fn is_fixed(self) -> bool {
|
||||
self == RigidBodyType::Fixed
|
||||
}
|
||||
|
||||
/// Is this rigid-body dynamic (i.e. can move and be affected by forces)?
|
||||
|
||||
@@ -93,20 +93,20 @@ impl ParallelInteractionGroups {
|
||||
.zip(self.interaction_colors.iter_mut())
|
||||
{
|
||||
let mut body_pair = interactions[*interaction_id].body_pair();
|
||||
let is_static1 = body_pair
|
||||
let is_fixed1 = body_pair
|
||||
.0
|
||||
.map(|b| ComponentSet::<RigidBodyType>::index(bodies, b.0).is_static())
|
||||
.map(|b| ComponentSet::<RigidBodyType>::index(bodies, b.0).is_fixed())
|
||||
.unwrap_or(true);
|
||||
let is_static2 = body_pair
|
||||
let is_fixed2 = body_pair
|
||||
.1
|
||||
.map(|b| ComponentSet::<RigidBodyType>::index(bodies, b.0).is_static())
|
||||
.map(|b| ComponentSet::<RigidBodyType>::index(bodies, b.0).is_fixed())
|
||||
.unwrap_or(true);
|
||||
|
||||
let representative = |handle: RigidBodyHandle| {
|
||||
if let Some(link) = multibodies.rigid_body_link(handle).copied() {
|
||||
let multibody = multibodies.get_multibody(link.multibody).unwrap();
|
||||
multibody
|
||||
.link(1) // Use the link 1 to cover the case where the multibody root is static.
|
||||
.link(1) // Use the link 1 to cover the case where the multibody root is fixed.
|
||||
.or(multibody.link(0)) // TODO: Never happens?
|
||||
.map(|l| l.rigid_body)
|
||||
.unwrap()
|
||||
@@ -120,7 +120,7 @@ impl ParallelInteractionGroups {
|
||||
body_pair.1.map(representative),
|
||||
);
|
||||
|
||||
match (is_static1, is_static2) {
|
||||
match (is_fixed1, is_fixed2) {
|
||||
(false, false) => {
|
||||
let rb_ids1: &RigidBodyIds = bodies.index(body_pair.0.unwrap().0);
|
||||
let rb_ids2: &RigidBodyIds = bodies.index(body_pair.1.unwrap().0);
|
||||
@@ -268,10 +268,10 @@ impl InteractionGroups {
|
||||
let (status2, ids2): (&RigidBodyType, &RigidBodyIds) =
|
||||
bodies.index_bundle(interaction.body2.0);
|
||||
|
||||
let is_static1 = !status1.is_dynamic();
|
||||
let is_static2 = !status2.is_dynamic();
|
||||
let is_fixed1 = !status1.is_dynamic();
|
||||
let is_fixed2 = !status2.is_dynamic();
|
||||
|
||||
if is_static1 && is_static2 {
|
||||
if is_fixed1 && is_fixed2 {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -334,13 +334,13 @@ impl InteractionGroups {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: static bodies don't transmit forces. Therefore they don't
|
||||
// NOTE: fixed bodies don't transmit forces. Therefore they don't
|
||||
// imply any interaction conflicts.
|
||||
if !is_static1 {
|
||||
if !is_fixed1 {
|
||||
self.body_masks[i1] |= target_mask_bit;
|
||||
}
|
||||
|
||||
if !is_static2 {
|
||||
if !is_fixed2 {
|
||||
self.body_masks[i2] |= target_mask_bit;
|
||||
}
|
||||
}
|
||||
@@ -431,21 +431,21 @@ impl InteractionGroups {
|
||||
let data: (_, &RigidBodyIds) = bodies.index_bundle(rb1.0);
|
||||
(*data.0, data.1.active_set_offset)
|
||||
} else {
|
||||
(RigidBodyType::Static, 0)
|
||||
(RigidBodyType::Fixed, 0)
|
||||
};
|
||||
let (status2, active_set_offset2) = if let Some(rb2) = interaction.data.rigid_body2
|
||||
{
|
||||
let data: (_, &RigidBodyIds) = bodies.index_bundle(rb2.0);
|
||||
(*data.0, data.1.active_set_offset)
|
||||
} else {
|
||||
(RigidBodyType::Static, 0)
|
||||
(RigidBodyType::Fixed, 0)
|
||||
};
|
||||
|
||||
let is_static1 = !status1.is_dynamic();
|
||||
let is_static2 = !status2.is_dynamic();
|
||||
let is_fixed1 = !status1.is_dynamic();
|
||||
let is_fixed2 = !status2.is_dynamic();
|
||||
|
||||
// TODO: don't generate interactions between static bodies in the first place.
|
||||
if is_static1 && is_static2 {
|
||||
// TODO: don't generate interactions between fixed bodies in the first place.
|
||||
if is_fixed1 && is_fixed2 {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -489,13 +489,13 @@ impl InteractionGroups {
|
||||
occupied_mask = occupied_mask | target_mask_bit;
|
||||
}
|
||||
|
||||
// NOTE: static bodies don't transmit forces. Therefore they don't
|
||||
// NOTE: fixed bodies don't transmit forces. Therefore they don't
|
||||
// imply any interaction conflicts.
|
||||
if !is_static1 {
|
||||
if !is_fixed1 {
|
||||
self.body_masks[i1] |= target_mask_bit;
|
||||
}
|
||||
|
||||
if !is_static2 {
|
||||
if !is_fixed2 {
|
||||
self.body_masks[i2] |= target_mask_bit;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user