Using particle physics with rigid bodies
-
- Posts: 19
- Joined: Mon Nov 10, 2008 11:24 am
Using particle physics with rigid bodies
Is there a way to turn off the angular momentum part of bullet for Rigid Bodies so they behave like particles except have non-spherical collision shapes?
-
- Posts: 5
- Joined: Sun Aug 03, 2008 7:31 am
Re: Using particle physics with rigid bodies
Hi,
you can body->setAngularFactor(0); then the body will not receive torque force...
if you use SIMD, which is msvc and 32bit only.
you also need to fix the code in btSequentialImpulseConstraintSolver.cpp
btSequentialImpulseConstraintSolver::resolveSingleConstraintRowLowerLimitSIMD()
and
btSequentialImpulseConstraintSolver::resolveSingleConstraintRowGenericSIMD()
find and change:
body1.m_deltaAngularVelocity.mVec128 = _mm_add_ps(body1.m_deltaAngularVelocity.mVec128 ,
_mm_mul_ps(c.m_angularComponentA.mVec128,impulseMagnitude));
to:
body1.m_deltaAngularVelocity.mVec128 = _mm_add_ps(body1.m_deltaAngularVelocity.mVec128 ,
_mm_mul_ps(c.m_angularComponentA.mVec128,_mm_mul_ps(impulseMagnitude,_mm_set1_ps(body1.m_angularFactor))));
and the same for body2, in both functions.
the original code in v2.73 ignored m_angularFactor. so the body will roll...
you can body->setAngularFactor(0); then the body will not receive torque force...
if you use SIMD, which is msvc and 32bit only.
you also need to fix the code in btSequentialImpulseConstraintSolver.cpp
btSequentialImpulseConstraintSolver::resolveSingleConstraintRowLowerLimitSIMD()
and
btSequentialImpulseConstraintSolver::resolveSingleConstraintRowGenericSIMD()
find and change:
body1.m_deltaAngularVelocity.mVec128 = _mm_add_ps(body1.m_deltaAngularVelocity.mVec128 ,
_mm_mul_ps(c.m_angularComponentA.mVec128,impulseMagnitude));
to:
body1.m_deltaAngularVelocity.mVec128 = _mm_add_ps(body1.m_deltaAngularVelocity.mVec128 ,
_mm_mul_ps(c.m_angularComponentA.mVec128,_mm_mul_ps(impulseMagnitude,_mm_set1_ps(body1.m_angularFactor))));
and the same for body2, in both functions.
the original code in v2.73 ignored m_angularFactor. so the body will roll...
-
- Posts: 19
- Joined: Mon Nov 10, 2008 11:24 am
Re: Using particle physics with rigid bodies
Thanks that worked great,