Fix btSoftBody issue, so it can interact with btCollisionObject and btGhostObject (and not just btRigidBody and btSoftBody)
Thank for the report mi076 http://www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=9&t=2823 remove legacy.c from libxml removed #include <math.h> from btQuadWord.h , it should be centralized in btScalar.h (to allow easier replacement with fastmath.h etc)
This commit is contained in:
@@ -1724,9 +1724,16 @@ void SoftDemo::initPhysics()
|
||||
tr.setOrigin(btVector3(0,-12,0));
|
||||
|
||||
|
||||
|
||||
localCreateRigidBody(0.f,tr,m_collisionShapes[0]);
|
||||
|
||||
#define USE_COLLISION_OBJECT 1
|
||||
#ifdef USE_COLLISION_OBJECT
|
||||
btCollisionObject* newOb = new btCollisionObject();
|
||||
newOb->setWorldTransform(tr);
|
||||
newOb->setInterpolationWorldTransform( tr);
|
||||
newOb->setCollisionShape(m_collisionShapes[0]);
|
||||
m_dynamicsWorld->addCollisionObject(newOb);
|
||||
#else
|
||||
this->localCreateRigidBody(0,tr,m_collisionShapes[0]);
|
||||
#endif //USE_COLLISION_OBJECT
|
||||
|
||||
// clientResetScene();
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ ADD_LIBRARY(XML
|
||||
hash.c
|
||||
HTMLparser.c
|
||||
HTMLtree.c
|
||||
legacy.c
|
||||
list.c
|
||||
nanoftp.c
|
||||
nanohttp.c
|
||||
|
||||
@@ -27,7 +27,7 @@ libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c \
|
||||
catalog.c globals.c threads.c c14n.c xmlstring.c \
|
||||
xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c \
|
||||
triostr.c trio.c xmlreader.c relaxng.c dict.c SAX2.c \
|
||||
xmlwriter.c legacy.c chvalid.c pattern.c xmlsave.c \
|
||||
xmlwriter.c chvalid.c pattern.c xmlsave.c \
|
||||
xmlmodule.c schematron.c
|
||||
else
|
||||
libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c \
|
||||
@@ -37,7 +37,7 @@ libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c \
|
||||
catalog.c globals.c threads.c c14n.c xmlstring.c \
|
||||
xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c \
|
||||
xmlreader.c relaxng.c dict.c SAX2.c \
|
||||
xmlwriter.c legacy.c chvalid.c pattern.c xmlsave.c \
|
||||
xmlwriter.c chvalid.c pattern.c xmlsave.c \
|
||||
xmlmodule.c schematron.c
|
||||
endif
|
||||
|
||||
|
||||
@@ -2600,7 +2600,7 @@ void btSoftBody::defaultCollisionHandler(btCollisionObject* pco)
|
||||
case fCollision::CL_RS:
|
||||
{
|
||||
btSoftColliders::CollideCL_RS collider;
|
||||
collider.Process(this,btRigidBody::upcast(pco));
|
||||
collider.Process(this,pco);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -326,9 +326,15 @@ public:
|
||||
{
|
||||
Cluster* m_soft;
|
||||
btRigidBody* m_rigid;
|
||||
Body() : m_soft(0),m_rigid(0) {}
|
||||
Body(Cluster* p) : m_soft(p),m_rigid(0) {}
|
||||
Body(btRigidBody* p) : m_soft(0),m_rigid(p) {}
|
||||
btCollisionObject* m_collisionObject;
|
||||
|
||||
Body() : m_soft(0),m_rigid(0),m_collisionObject(0) {}
|
||||
Body(Cluster* p) : m_soft(p),m_rigid(0),m_collisionObject(0) {}
|
||||
Body(btCollisionObject* colObj) : m_soft(0),m_collisionObject(colObj)
|
||||
{
|
||||
m_rigid = btRigidBody::upcast(m_collisionObject);
|
||||
}
|
||||
|
||||
void activate() const
|
||||
{
|
||||
if(m_rigid) m_rigid->activate();
|
||||
@@ -349,7 +355,7 @@ public:
|
||||
const btTransform& xform() const
|
||||
{
|
||||
static const btTransform identity=btTransform::getIdentity();
|
||||
if(m_rigid) return(m_rigid->getInterpolationWorldTransform());
|
||||
if(m_collisionObject) return(m_collisionObject->getInterpolationWorldTransform());
|
||||
if(m_soft) return(m_soft->m_framexform);
|
||||
return(identity);
|
||||
}
|
||||
|
||||
@@ -708,23 +708,24 @@ struct btSoftColliders
|
||||
struct CollideCL_RS : ClusterBase
|
||||
{
|
||||
btSoftBody* psb;
|
||||
btRigidBody* prb;
|
||||
|
||||
btCollisionObject* m_colObj;
|
||||
void Process(const btDbvtNode* leaf)
|
||||
{
|
||||
btSoftBody::Cluster* cluster=(btSoftBody::Cluster*)leaf->data;
|
||||
btSoftClusterCollisionShape cshape(cluster);
|
||||
const btConvexShape* rshape=(const btConvexShape*)prb->getCollisionShape();
|
||||
const btConvexShape* rshape=(const btConvexShape*)m_colObj->getCollisionShape();
|
||||
btGjkEpaSolver2::sResults res;
|
||||
if(btGjkEpaSolver2::SignedDistance( &cshape,btTransform::getIdentity(),
|
||||
rshape,prb->getInterpolationWorldTransform(),
|
||||
rshape,m_colObj->getInterpolationWorldTransform(),
|
||||
btVector3(1,0,0),res))
|
||||
{
|
||||
btSoftBody::CJoint joint;
|
||||
if(SolveContact(res,cluster,prb,joint))
|
||||
if(SolveContact(res,cluster,m_colObj,joint))//prb,joint))
|
||||
{
|
||||
btSoftBody::CJoint* pj=new(btAlignedAlloc(sizeof(btSoftBody::CJoint),16)) btSoftBody::CJoint();
|
||||
*pj=joint;psb->m_joints.push_back(pj);
|
||||
if(prb->isStaticOrKinematicObject())
|
||||
if(m_colObj->isStaticOrKinematicObject())
|
||||
{
|
||||
pj->m_erp *= psb->m_cfg.kSKHR_CL;
|
||||
pj->m_split *= psb->m_cfg.kSK_SPLT_CL;
|
||||
@@ -737,19 +738,19 @@ struct btSoftColliders
|
||||
}
|
||||
}
|
||||
}
|
||||
void Process(btSoftBody* ps,btRigidBody* pr)
|
||||
void Process(btSoftBody* ps,btCollisionObject* colOb)
|
||||
{
|
||||
psb = ps;
|
||||
prb = pr;
|
||||
m_colObj = colOb;
|
||||
idt = ps->m_sst.isdt;
|
||||
margin = ps->getCollisionShape()->getMargin()+
|
||||
pr->getCollisionShape()->getMargin();
|
||||
friction = btMin(psb->m_cfg.kDF,prb->getFriction());
|
||||
margin = m_colObj->getCollisionShape()->getMargin()+
|
||||
m_colObj->getCollisionShape()->getMargin();
|
||||
friction = btMin(psb->m_cfg.kDF,m_colObj->getFriction());
|
||||
btVector3 mins;
|
||||
btVector3 maxs;
|
||||
|
||||
ATTRIBUTE_ALIGNED16(btDbvtVolume) volume;
|
||||
pr->getCollisionShape()->getAabb(pr->getInterpolationWorldTransform(),mins,maxs);
|
||||
colOb->getCollisionShape()->getAabb(colOb->getInterpolationWorldTransform(),mins,maxs);
|
||||
volume=btDbvtVolume::FromMM(mins,maxs);
|
||||
volume.Expand(btVector3(1,1,1)*margin);
|
||||
ps->m_cdbvt.collideTV(ps->m_cdbvt.m_root,volume,*this);
|
||||
|
||||
@@ -18,7 +18,7 @@ subject to the following restrictions:
|
||||
|
||||
#include "btScalar.h"
|
||||
#include "btMinMax.h"
|
||||
#include <math.h>
|
||||
|
||||
|
||||
#if defined (__CELLOS_LV2) && defined (__SPU__)
|
||||
#include <altivec.h>
|
||||
|
||||
@@ -18,6 +18,7 @@ subject to the following restrictions:
|
||||
#define SIMD___SCALAR_H
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <stdlib.h>//size_t for MSVC 6.0
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
Reference in New Issue
Block a user