pub struct JointDesc {
pub kind: JointKind,
pub local_anchor1: Vec3,
pub local_anchor2: Vec3,
pub reference_rotation: Option<Quat>,
pub contacts_enabled: bool,
pub enabled: bool,
pub limits: Option<[f32; 2]>,
pub motor: Option<JointMotor>,
pub break_limits: Option<BreakLimits>,
}Fields§
§kind: JointKind§local_anchor1: Vec3§local_anchor2: Vec3§reference_rotation: Option<Quat>None captures the bodies’ relative orientation at insertion.
contacts_enabled: bool§enabled: bool§limits: Option<[f32; 2]>Twist range relative to the captured orientation, in radians [-pi, pi].
motor: Option<JointMotor>§break_limits: Option<BreakLimits>Implementations§
Source§impl JointDesc
impl JointDesc
pub fn new(kind: JointKind) -> JointDesc
Sourcepub fn validate(self, planar: bool) -> Result<(), JointValidationError>
pub fn validate(self, planar: bool) -> Result<(), JointValidationError>
Checks authored fields, returning the first invalid field and its cause.
Pass true for a 2D world and false for a 3D world. This uses the same
bounds as insertion, but does not check body handles, body types or world
capacity. Insertion still performs those checks. No values are changed.
use ferravex_math::Vec3;
use ferravex_physics::{JointDesc, JointKind};
let mut desc = JointDesc::new(JointKind::Hinge {
axis1: Vec3::Z,
axis2: Vec3::Z,
});
desc.limits = Some([-0.5, 0.5]);
desc.validate(true).unwrap();
desc.limits = Some([0.5, -0.5]);
assert_eq!(desc.validate(true).unwrap_err().field(), "limits");Trait Implementations§
Source§impl From<JointBuilder> for JointDesc
impl From<JointBuilder> for JointDesc
Source§fn from(b: JointBuilder) -> JointDesc
fn from(b: JointBuilder) -> JointDesc
Converts to this type from the input type.
Source§impl From<JointBuilder> for JointDesc
impl From<JointBuilder> for JointDesc
Source§fn from(b: JointBuilder) -> JointDesc
fn from(b: JointBuilder) -> JointDesc
Converts to this type from the input type.
impl Copy for JointDesc
impl StructuralPartialEq for JointDesc
Auto Trait Implementations§
impl Freeze for JointDesc
impl RefUnwindSafe for JointDesc
impl Send for JointDesc
impl Sync for JointDesc
impl Unpin for JointDesc
impl UnwindSafe for JointDesc
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
Mutably borrows from an owned value. Read more