Fix reported contact impulse in the contact force event
Address https://github.com/dimforge/rapier.js/issues/261
This commit is contained in:
committed by
Sébastien Crozet
parent
59dc9bfe00
commit
09af4313fa
@@ -13,9 +13,9 @@ pub(crate) struct TwoBodyConstraintTangentPart<N: SimdRealCopy> {
|
||||
#[cfg(feature = "dim3")]
|
||||
pub impulse: na::Vector2<N>,
|
||||
#[cfg(feature = "dim2")]
|
||||
pub total_impulse: na::Vector1<N>,
|
||||
pub impulse_accumulator: na::Vector1<N>,
|
||||
#[cfg(feature = "dim3")]
|
||||
pub total_impulse: na::Vector2<N>,
|
||||
pub impulse_accumulator: na::Vector2<N>,
|
||||
#[cfg(feature = "dim2")]
|
||||
pub r: [N; 1],
|
||||
#[cfg(feature = "dim3")]
|
||||
@@ -30,7 +30,7 @@ impl<N: SimdRealCopy> TwoBodyConstraintTangentPart<N> {
|
||||
rhs: [na::zero(); DIM - 1],
|
||||
rhs_wo_bias: [na::zero(); DIM - 1],
|
||||
impulse: na::zero(),
|
||||
total_impulse: na::zero(),
|
||||
impulse_accumulator: na::zero(),
|
||||
#[cfg(feature = "dim2")]
|
||||
r: [na::zero(); 1],
|
||||
#[cfg(feature = "dim3")]
|
||||
@@ -38,6 +38,20 @@ impl<N: SimdRealCopy> TwoBodyConstraintTangentPart<N> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Total impulse applied across all the solver substeps.
|
||||
#[inline]
|
||||
#[cfg(feature = "dim2")]
|
||||
pub fn total_impulse(&self) -> na::Vector1<N> {
|
||||
self.impulse_accumulator + self.impulse
|
||||
}
|
||||
|
||||
/// Total impulse applied across all the solver substeps.
|
||||
#[inline]
|
||||
#[cfg(feature = "dim3")]
|
||||
pub fn total_impulse(&self) -> na::Vector2<N> {
|
||||
self.impulse_accumulator + self.impulse
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn apply_limit(
|
||||
&mut self,
|
||||
@@ -166,7 +180,7 @@ pub(crate) struct TwoBodyConstraintNormalPart<N: SimdRealCopy> {
|
||||
pub rhs: N,
|
||||
pub rhs_wo_bias: N,
|
||||
pub impulse: N,
|
||||
pub total_impulse: N,
|
||||
pub impulse_accumulator: N,
|
||||
pub r: N,
|
||||
}
|
||||
|
||||
@@ -178,11 +192,17 @@ impl<N: SimdRealCopy> TwoBodyConstraintNormalPart<N> {
|
||||
rhs: na::zero(),
|
||||
rhs_wo_bias: na::zero(),
|
||||
impulse: na::zero(),
|
||||
total_impulse: na::zero(),
|
||||
impulse_accumulator: na::zero(),
|
||||
r: na::zero(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Total impulse applied across all the solver substeps.
|
||||
#[inline]
|
||||
pub fn total_impulse(&self) -> N {
|
||||
self.impulse_accumulator + self.impulse
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn solve(
|
||||
&mut self,
|
||||
|
||||
Reference in New Issue
Block a user