feat: rework solver parameters to make it easy to recover the old behaviors
This commit is contained in:
@@ -118,8 +118,11 @@ impl RopeJoint {
|
||||
|
||||
/// The maximum distance allowed between the attached objects.
|
||||
#[must_use]
|
||||
pub fn max_distance(&self) -> Option<Real> {
|
||||
self.data.limits(JointAxis::X).map(|l| l.max)
|
||||
pub fn max_distance(&self) -> Real {
|
||||
self.data
|
||||
.limits(JointAxis::X)
|
||||
.map(|l| l.max)
|
||||
.unwrap_or(Real::MAX)
|
||||
}
|
||||
|
||||
/// Sets the maximum allowed distance between the attached objects.
|
||||
@@ -146,8 +149,6 @@ pub struct RopeJointBuilder(pub RopeJoint);
|
||||
|
||||
impl RopeJointBuilder {
|
||||
/// Creates a new builder for rope joints.
|
||||
///
|
||||
/// This axis is expressed in the local-space of both rigid-bodies.
|
||||
pub fn new(max_dist: Real) -> Self {
|
||||
Self(RopeJoint::new(max_dist))
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ use crate::math::{Point, Real};
|
||||
#[repr(transparent)]
|
||||
/// A spring-damper joint, applies a force proportional to the distance between two objects.
|
||||
///
|
||||
/// The spring is integrated implicitly, implying that an even undamped spring will still be subject to some
|
||||
/// The spring is integrated implicitly, implying that even an undamped spring will be subject to some
|
||||
/// amount of numerical damping (so it will eventually come to a rest). More solver iterations, or smaller
|
||||
/// timesteps, will lower the effect of numerical damping, providing a more realistic result.
|
||||
pub struct SpringJoint {
|
||||
|
||||
Reference in New Issue
Block a user