pub struct PyConstraint {
pub handle: u32,
pub constraint_type: ConstraintType,
pub body_a: u32,
pub body_b: u32,
pub anchor_a: [f64; 3],
pub anchor_b: [f64; 3],
pub target_distance: f64,
pub axis: [f64; 3],
pub stiffness: f64,
pub enabled: bool,
}Expand description
A constraint between two rigid bodies.
Constraints are stored in the world and resolved during each step. Currently implemented as soft position-level corrections.
Fields§
§handle: u32Unique handle.
constraint_type: ConstraintTypeType of constraint.
body_a: u32Handle of the first body.
body_b: u32Handle of the second body.
anchor_a: [f64; 3]Anchor point on body_a in local coordinates (or world if no body).
anchor_b: [f64; 3]Anchor point on body_b in local coordinates.
target_distance: f64Target distance (for Distance constraints).
axis: [f64; 3]Hinge axis in world space (for Hinge constraints).
stiffness: f64Constraint stiffness (0..1, 1 = rigid).
enabled: boolWhether the constraint is currently active.
Implementations§
Source§impl PyConstraint
impl PyConstraint
Sourcepub fn distance(
handle: u32,
body_a: u32,
body_b: u32,
anchor_a: [f64; 3],
anchor_b: [f64; 3],
distance: f64,
) -> Self
pub fn distance( handle: u32, body_a: u32, body_b: u32, anchor_a: [f64; 3], anchor_b: [f64; 3], distance: f64, ) -> Self
Create a distance constraint between two bodies.
Sourcepub fn point_to_point(
handle: u32,
body_a: u32,
body_b: u32,
pivot: [f64; 3],
) -> Self
pub fn point_to_point( handle: u32, body_a: u32, body_b: u32, pivot: [f64; 3], ) -> Self
Create a point-to-point constraint (ball-socket joint).
Sourcepub fn hinge(
handle: u32,
body_a: u32,
body_b: u32,
pivot: [f64; 3],
axis: [f64; 3],
) -> Self
pub fn hinge( handle: u32, body_a: u32, body_b: u32, pivot: [f64; 3], axis: [f64; 3], ) -> Self
Create a hinge constraint around axis at pivot.
Sourcepub fn with_stiffness(self, s: f64) -> Self
pub fn with_stiffness(self, s: f64) -> Self
Set constraint stiffness (builder pattern).
Sourcepub fn set_enabled(&mut self, enabled: bool)
pub fn set_enabled(&mut self, enabled: bool)
Enable or disable the constraint.
Trait Implementations§
Source§impl Clone for PyConstraint
impl Clone for PyConstraint
Source§fn clone(&self) -> PyConstraint
fn clone(&self) -> PyConstraint
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PyConstraint
impl RefUnwindSafe for PyConstraint
impl Send for PyConstraint
impl Sync for PyConstraint
impl Unpin for PyConstraint
impl UnsafeUnpin for PyConstraint
impl UnwindSafe for PyConstraint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.