Fix for btCapsuleShape, m_localScaling is already applied to the radius/halfExtents so don't apply it again in the localGetSupportVertex(NonVirtual)
Make sure SerializeDemo compiles fine without DESERIALIZE_SOFT_BODIES defined
This commit is contained in:
@@ -84,11 +84,14 @@ void SerializeDemo::clientMoveAndDisplay()
|
||||
|
||||
m_dynamicsWorld->stepSimulation(ms / 1000000.f);
|
||||
|
||||
#ifdef DESERIALIZE_SOFT_BODIES
|
||||
if (fSoftBodySolver)
|
||||
fSoftBodySolver->copyBackToSoftBodies();
|
||||
#endif
|
||||
|
||||
m_dynamicsWorld->debugDrawWorld();
|
||||
|
||||
#ifdef DESERIALIZE_SOFT_BODIES
|
||||
if (m_dynamicsWorld->getWorldType()==BT_SOFT_RIGID_DYNAMICS_WORLD)
|
||||
{
|
||||
//optional but useful: debug drawing
|
||||
@@ -104,6 +107,8 @@ void SerializeDemo::clientMoveAndDisplay()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif //DESERIALIZE_SOFT_BODIES
|
||||
|
||||
}
|
||||
|
||||
renderme();
|
||||
@@ -122,6 +127,8 @@ void SerializeDemo::displayCallback(void) {
|
||||
|
||||
if (m_dynamicsWorld->getWorldType()==BT_SOFT_RIGID_DYNAMICS_WORLD)
|
||||
{
|
||||
#ifdef DESERIALIZE_SOFT_BODIES
|
||||
|
||||
//optional but useful: debug drawing
|
||||
btSoftRigidDynamicsWorld* softWorld = (btSoftRigidDynamicsWorld*)m_dynamicsWorld;
|
||||
|
||||
@@ -134,6 +141,7 @@ void SerializeDemo::displayCallback(void) {
|
||||
btSoftBodyHelpers::Draw(psb,softWorld->getDebugDrawer(),softWorld->getDrawFlags());
|
||||
}
|
||||
}
|
||||
#endif //DESERIALIZE_SOFT_BODIES
|
||||
}
|
||||
|
||||
renderme();
|
||||
|
||||
@@ -55,7 +55,7 @@ btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height) : btConvexInter
|
||||
btVector3 pos(0,0,0);
|
||||
pos[getUpAxis()] = getHalfHeight();
|
||||
|
||||
vtx = pos +vec*m_localScaling*(radius) - vec * getMargin();
|
||||
vtx = pos +vec*(radius) - vec * getMargin();
|
||||
newDot = vec.dot(vtx);
|
||||
if (newDot > maxDot)
|
||||
{
|
||||
@@ -67,7 +67,7 @@ btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height) : btConvexInter
|
||||
btVector3 pos(0,0,0);
|
||||
pos[getUpAxis()] = -getHalfHeight();
|
||||
|
||||
vtx = pos +vec*m_localScaling*(radius) - vec * getMargin();
|
||||
vtx = pos +vec*(radius) - vec * getMargin();
|
||||
newDot = vec.dot(vtx);
|
||||
if (newDot > maxDot)
|
||||
{
|
||||
@@ -96,7 +96,7 @@ btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height) : btConvexInter
|
||||
{
|
||||
btVector3 pos(0,0,0);
|
||||
pos[getUpAxis()] = getHalfHeight();
|
||||
vtx = pos +vec*m_localScaling*(radius) - vec * getMargin();
|
||||
vtx = pos +vec*(radius) - vec * getMargin();
|
||||
newDot = vec.dot(vtx);
|
||||
if (newDot > maxDot)
|
||||
{
|
||||
@@ -107,7 +107,7 @@ btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height) : btConvexInter
|
||||
{
|
||||
btVector3 pos(0,0,0);
|
||||
pos[getUpAxis()] = -getHalfHeight();
|
||||
vtx = pos +vec*m_localScaling*(radius) - vec * getMargin();
|
||||
vtx = pos +vec*(radius) - vec * getMargin();
|
||||
newDot = vec.dot(vtx);
|
||||
if (newDot > maxDot)
|
||||
{
|
||||
|
||||
@@ -244,7 +244,7 @@ btVector3 btConvexShape::localGetSupportVertexWithoutMarginNonVirtual (const btV
|
||||
pos[capsuleUpAxis] = halfHeight;
|
||||
|
||||
//vtx = pos +vec*(radius);
|
||||
vtx = pos +vec*capsuleShape->getLocalScalingNV()*(radius) - vec * capsuleShape->getMarginNV();
|
||||
vtx = pos +vec*(radius) - vec * capsuleShape->getMarginNV();
|
||||
newDot = vec.dot(vtx);
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@ btVector3 btConvexShape::localGetSupportVertexWithoutMarginNonVirtual (const btV
|
||||
pos[capsuleUpAxis] = -halfHeight;
|
||||
|
||||
//vtx = pos +vec*(radius);
|
||||
vtx = pos +vec*capsuleShape->getLocalScalingNV()*(radius) - vec * capsuleShape->getMarginNV();
|
||||
vtx = pos +vec*(radius) - vec * capsuleShape->getMarginNV();
|
||||
newDot = vec.dot(vtx);
|
||||
if (newDot > maxDot)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user