rename HasHit method to hasHit

rename AddSingleResult to addSingleResult
moved collision filtering for btCollisionWorld::rayTest and btCollisionWorld::convexSweepTest from argument to the callback needsCollision
This commit is contained in:
erwin.coumans 2008-07-09 23:30:21 +00:00
parent 9996da6f2d
commit b66e5350d0
18 changed files with 108 additions and 70 deletions

View File

@ -141,7 +141,7 @@ public:
btCollisionWorld::ClosestRayResultCallback cb(source[i], dest[i]);
cw->rayTest (source[i], dest[i], cb);
if (cb.HasHit ())
if (cb.hasHit ())
{
hit[i] = cb.m_hitPointWorld;
normal[i] = cb.m_hitNormalWorld;

View File

@ -46,7 +46,7 @@ static int gJump = 0;
///playerStepCallback is the main function that is updating the character.
///Register this callback using: m_dynamicsWorld->setInternalTickCallback(playerStepCallback,m_character);
///This function will be called at the end of each internal simulation time step
void playerStepCallback(const btDynamicsWorld* dynamicsWorld, btScalar timeStep)
void playerStepCallback(btDynamicsWorld* dynamicsWorld, btScalar timeStep)
{
CharacterControllerInterface* characterInterface= (CharacterControllerInterface*) dynamicsWorld->getWorldUserInfo();
characterInterface->preStep (dynamicsWorld);
@ -501,10 +501,9 @@ const float TRIANGLE_SIZE=20.f;
sweepBP->setOverlappingPairUserCallback(m_customPairCallback);
m_character->registerPairCacheAndDispatcher (m_customPairCallback->getOverlappingPairCache(), m_dispatcher);
m_dynamicsWorld->addCollisionObject(m_character->getCollisionObject(),btBroadphaseProxy::DebrisFilter, btBroadphaseProxy::StaticFilter);//AllFilter);
///only collide with static for now (no interaction with dynamic objects)
m_dynamicsWorld->addCollisionObject(m_character->getCollisionObject(),btBroadphaseProxy::DebrisFilter, btBroadphaseProxy::StaticFilter);
clientResetScene();
setCameraDistance(26.f);

View File

@ -90,12 +90,12 @@ void DynamicCharacterController::preStep (const btCollisionWorld* collisionWorld
m_me = me;
}
virtual btScalar AddSingleResult(btCollisionWorld::LocalRayResult& rayResult,bool normalInWorldSpace)
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult,bool normalInWorldSpace)
{
if (rayResult.m_collisionObject == m_me)
return 1.0;
return ClosestRayResultCallback::AddSingleResult (rayResult, normalInWorldSpace
return ClosestRayResultCallback::addSingleResult (rayResult, normalInWorldSpace
);
}
protected:
@ -109,7 +109,7 @@ void DynamicCharacterController::preStep (const btCollisionWorld* collisionWorld
{
rayCallback.m_closestHitFraction = 1.0;
collisionWorld->rayTest (m_raySource[i], m_rayTarget[i], rayCallback);
if (rayCallback.HasHit())
if (rayCallback.hasHit())
{
m_rayLambda[i] = rayCallback.m_closestHitFraction;
} else {

View File

@ -9,7 +9,6 @@
#include "KinematicCharacterController.h"
/* TODO:
* Fix jitter
* Interact with dynamic objects
* Ride kinematicly animated platforms properly
* More realistic (or maybe just a config option) falling
@ -25,12 +24,12 @@ public:
m_me = me;
}
virtual btScalar AddSingleResult(btCollisionWorld::LocalRayResult& rayResult,bool normalInWorldSpace)
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult,bool normalInWorldSpace)
{
if (rayResult.m_collisionObject == m_me)
return 1.0;
return ClosestRayResultCallback::AddSingleResult (rayResult, normalInWorldSpace);
return ClosestRayResultCallback::addSingleResult (rayResult, normalInWorldSpace);
}
protected:
btCollisionObject* m_me;
@ -44,12 +43,12 @@ public:
m_me = me;
}
virtual btScalar AddSingleResult(btCollisionWorld::LocalConvexResult& convexResult,bool normalInWorldSpace)
virtual btScalar addSingleResult(btCollisionWorld::LocalConvexResult& convexResult,bool normalInWorldSpace)
{
if (convexResult.m_hitCollisionObject == m_me)
return 1.0;
return ClosestConvexResultCallback::AddSingleResult (convexResult, normalInWorldSpace);
return ClosestConvexResultCallback::addSingleResult (convexResult, normalInWorldSpace);
}
protected:
btCollisionObject* m_me;
@ -213,10 +212,12 @@ void KinematicCharacterController::stepUp (const btCollisionWorld* world)
end.setOrigin (m_targetPosition);
ClosestNotMeConvexResultCallback callback (m_collisionObject);
callback.m_collisionFilterGroup = getCollisionObject()->getBroadphaseHandle()->m_collisionFilterGroup;
callback.m_collisionFilterMask = getCollisionObject()->getBroadphaseHandle()->m_collisionFilterMask;
world->convexSweepTest (m_shape, start, end, callback);
if (callback.HasHit())
if (callback.hasHit())
{
// we moved up only a fraction of the step height
m_currentStepOffset = m_stepHeight * callback.m_closestHitFraction;
@ -296,6 +297,9 @@ void KinematicCharacterController::stepForwardAndStrafe (const btCollisionWorld*
end.setOrigin (m_targetPosition);
ClosestNotMeConvexResultCallback callback (m_collisionObject);
callback.m_collisionFilterGroup = getCollisionObject()->getBroadphaseHandle()->m_collisionFilterGroup;
callback.m_collisionFilterMask = getCollisionObject()->getBroadphaseHandle()->m_collisionFilterMask;
//btScalar margin = m_shape->getMargin();
//m_shape->setMargin(margin - 0.06f);
@ -305,7 +309,7 @@ void KinematicCharacterController::stepForwardAndStrafe (const btCollisionWorld*
fraction -= callback.m_closestHitFraction;
if (callback.HasHit())
if (callback.hasHit())
{
// we moved only a fraction
btScalar hitDistance = (callback.m_hitPointWorld - m_currentPosition).length();
@ -364,10 +368,12 @@ void KinematicCharacterController::stepDown (const btCollisionWorld* collisionWo
end.setOrigin (m_targetPosition);
ClosestNotMeConvexResultCallback callback (m_collisionObject);
callback.m_collisionFilterGroup = getCollisionObject()->getBroadphaseHandle()->m_collisionFilterGroup;
callback.m_collisionFilterMask = getCollisionObject()->getBroadphaseHandle()->m_collisionFilterMask;
collisionWorld->convexSweepTest (m_shape, start, end, callback);
if (callback.HasHit())
if (callback.hasHit())
{
// we dropped a fraction of the height -> hit floor
m_currentPosition.setInterpolate3 (m_currentPosition, m_targetPosition, callback.m_closestHitFraction);

View File

@ -162,7 +162,7 @@ public:
btTransform from(qFrom, source[i]);
btTransform to(qTo, dest[i]);
cw->convexSweepTest (&boxShape, from, to, cb);
if (cb.HasHit ())
if (cb.hasHit ())
{
hit_surface[i] = cb.m_hitPointWorld;
hit_com[i].setInterpolate3(source[i], dest[i], cb.m_closestHitFraction);

View File

@ -181,7 +181,7 @@ public:
btCollisionWorld::ClosestRayResultCallback cb(source[i], dest[i]);
cw->rayTest (source[i], dest[i], cb);
if (cb.HasHit ())
if (cb.hasHit ())
{
hit[i] = cb.m_hitPointWorld;
normal[i] = cb.m_hitNormalWorld;

View File

@ -626,7 +626,7 @@ void DemoApplication::mouseFunc(int button, int state, int x, int y)
{
btCollisionWorld::ClosestRayResultCallback rayCallback(m_cameraPosition,rayTo);
m_dynamicsWorld->rayTest(m_cameraPosition,rayTo,rayCallback);
if (rayCallback.HasHit())
if (rayCallback.hasHit())
{
btRigidBody* body = btRigidBody::upcast(rayCallback.m_collisionObject);
@ -662,7 +662,7 @@ void DemoApplication::mouseFunc(int button, int state, int x, int y)
{
btCollisionWorld::ClosestRayResultCallback rayCallback(m_cameraPosition,rayTo);
m_dynamicsWorld->rayTest(m_cameraPosition,rayTo,rayCallback);
if (rayCallback.HasHit())
if (rayCallback.hasHit())
{

View File

@ -189,7 +189,7 @@ bool Raytracer::worldRaytest(const btVector3& rayFrom,const btVector3& rayTo,btV
btVector3 m_hitNormalWorld;
btVector3 m_hitPointWorld;
virtual btScalar AddSingleResult(btCollisionWorld::LocalRayResult& rayResult,bool normalInWorldSpace)
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult,bool normalInWorldSpace)
{
//caller already does the filter on the m_closestHitFraction
@ -215,7 +215,7 @@ bool Raytracer::worldRaytest(const btVector3& rayFrom,const btVector3& rayTo,btV
AllRayResultCallback resultCallback(rayFrom,rayTo);
// btCollisionWorld::ClosestRayResultCallback resultCallback(rayFrom,rayTo);
m_collisionWorld->rayTest(rayFrom,rayTo,resultCallback);
if (resultCallback.HasHit())
if (resultCallback.hasHit())
{
worldNormal = resultCallback.m_hitNormalWorld;
return true;
@ -261,7 +261,7 @@ bool Raytracer::singleObjectRaytest(const btVector3& rayFrom,const btVector3& ra
//reset previous result
btCollisionWorld::rayTestSingle(rayFromTrans,rayToTrans, &tmpObj, shapePtr[s], transforms[s], resultCallback);
if (resultCallback.HasHit())
if (resultCallback.hasHit())
{
//float fog = 1.f - 0.1f * rayResult.m_fraction;
resultCallback.m_hitNormalWorld.normalize();//.m_normal.normalize();

View File

@ -16,7 +16,7 @@ subject to the following restrictions:
#include "SpuRaycastTaskProcess.h"
SpuRaycastTaskProcess::SpuRaycastTaskProcess(class btThreadSupportInterface* threadInterface, unsigned int maxNumOutstandingTasks)
SpuRaycastTaskProcess::SpuRaycastTaskProcess(class btThreadSupportInterface* threadInterface, int maxNumOutstandingTasks)
:m_threadInterface(threadInterface),
m_maxNumOutstandingTasks(maxNumOutstandingTasks)
{
@ -122,7 +122,7 @@ void SpuRaycastTaskProcess::addWorkToTask(SpuRaycastTaskWorkUnit& workunit)
m_currentWorkUnitInTask = 0;
// find new task buffer
for (unsigned int i = 0; i < m_maxNumOutstandingTasks; i++)
for (int i = 0; i < m_maxNumOutstandingTasks; i++)
{
if (!m_taskBusy[i])
{

View File

@ -40,20 +40,20 @@ class SpuRaycastTaskProcess
btThreadSupportInterface* m_threadInterface;
unsigned int m_maxNumOutstandingTasks;
int m_maxNumOutstandingTasks;
unsigned int m_numBusyTasks;
int m_numBusyTasks;
// the current task and the current entry to insert a new work unit
unsigned int m_currentTask;
unsigned int m_currentWorkUnitInTask;
int m_currentTask;
int m_currentWorkUnitInTask;
int m_numSpuCollisionObjectWrappers;
void* m_spuCollisionObjectWrappers;
void issueTask2();
//void postProcess(unsigned int taskId, int outputSize);
public:
SpuRaycastTaskProcess(btThreadSupportInterface* threadInterface, unsigned int maxNumOutstandingTasks);
SpuRaycastTaskProcess(btThreadSupportInterface* threadInterface, int maxNumOutstandingTasks);
~SpuRaycastTaskProcess();

View File

@ -79,7 +79,7 @@ BT_DECLARE_ALIGNED_ALLOCATOR();
KinematicFilter = 4,
DebrisFilter = 8,
SensorTrigger = 16,
AllFilter = DefaultFilter | StaticFilter | KinematicFilter | DebrisFilter | SensorTrigger
AllFilter = -1 //all bits sets: DefaultFilter | StaticFilter | KinematicFilter | DebrisFilter | SensorTrigger
};
//Usually the client btCollisionObject or Rigidbody class

View File

@ -1162,4 +1162,4 @@ if(cfgBenchmark15_Enable)
}
printf("\r\n\r\n");
}
#endif
#endif

View File

@ -191,7 +191,7 @@ struct btDbvt
// Constants
enum {
SIMPLE_STACKSIZE = 64,
DOUBLE_STACKSIZE = SIMPLE_STACKSIZE*2,
DOUBLE_STACKSIZE = SIMPLE_STACKSIZE*2
};
// Fields
@ -759,7 +759,7 @@ if(root)
const int inside=(1<<count)-1;
btAlignedObjectArray<sStkNP> stack;
int signs[sizeof(unsigned)*8];
btAssert(count<(sizeof(signs)/sizeof(signs[0])));
btAssert(count<int (sizeof(signs)/sizeof(signs[0])));
for(int i=0;i<count;++i)
{
signs[i]= ((normals[i].x()>=0)?1:0)+
@ -821,7 +821,7 @@ if(root)
btAlignedObjectArray<int> ifree;
btAlignedObjectArray<int> stack;
int signs[sizeof(unsigned)*8];
btAssert(count<(sizeof(signs)/sizeof(signs[0])));
btAssert(count<int (sizeof(signs)/sizeof(signs[0])));
for(int i=0;i<count;++i)
{
signs[i]= ((normals[i].x()>=0)?1:0)+

View File

@ -213,7 +213,7 @@ void btCollisionWorld::rayTestSingle(const btTransform& rayFromTrans,const btTra
btCollisionObject* collisionObject,
const btCollisionShape* collisionShape,
const btTransform& colObjWorldTransform,
RayResultCallback& resultCallback,short int collisionFilterMask)
RayResultCallback& resultCallback)
{
btSphereShape pointShape(btScalar(0.0));
pointShape.setMargin(0.f);
@ -256,7 +256,7 @@ void btCollisionWorld::rayTestSingle(const btTransform& rayFromTrans,const btTra
);
bool normalInWorldSpace = true;
resultCallback.AddSingleResult(localRayResult, normalInWorldSpace);
resultCallback.addSingleResult(localRayResult, normalInWorldSpace);
}
}
@ -302,7 +302,7 @@ void btCollisionWorld::rayTestSingle(const btTransform& rayFromTrans,const btTra
hitFraction);
bool normalInWorldSpace = false;
return m_resultCallback->AddSingleResult(rayResult,normalInWorldSpace);
return m_resultCallback->addSingleResult(rayResult,normalInWorldSpace);
}
};
@ -350,7 +350,7 @@ void btCollisionWorld::rayTestSingle(const btTransform& rayFromTrans,const btTra
hitFraction);
bool normalInWorldSpace = false;
return m_resultCallback->AddSingleResult(rayResult,normalInWorldSpace);
return m_resultCallback->addSingleResult(rayResult,normalInWorldSpace);
}
@ -383,7 +383,7 @@ void btCollisionWorld::rayTestSingle(const btTransform& rayFromTrans,const btTra
collisionObject,
childCollisionShape,
childWorldTrans,
resultCallback, collisionFilterMask);
resultCallback);
}
}
@ -395,7 +395,7 @@ void btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const bt
btCollisionObject* collisionObject,
const btCollisionShape* collisionShape,
const btTransform& colObjWorldTransform,
ConvexResultCallback& resultCallback, btScalar allowedPenetration,short int collisionFilterMask)
ConvexResultCallback& resultCallback, btScalar allowedPenetration)
{
if (collisionShape->isConvex())
{
@ -435,7 +435,7 @@ void btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const bt
);
bool normalInWorldSpace = true;
resultCallback.AddSingleResult(localConvexResult, normalInWorldSpace);
resultCallback.addSingleResult(localConvexResult, normalInWorldSpace);
}
}
@ -487,7 +487,7 @@ void btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const bt
bool normalInWorldSpace = true;
return m_resultCallback->AddSingleResult(convexResult,normalInWorldSpace);
return m_resultCallback->addSingleResult(convexResult,normalInWorldSpace);
}
return hitFraction;
}
@ -542,7 +542,7 @@ void btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const bt
bool normalInWorldSpace = false;
return m_resultCallback->AddSingleResult(convexResult,normalInWorldSpace);
return m_resultCallback->addSingleResult(convexResult,normalInWorldSpace);
}
return hitFraction;
}
@ -577,14 +577,14 @@ void btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const bt
collisionObject,
childCollisionShape,
childWorldTrans,
resultCallback, allowedPenetration,collisionFilterMask);
resultCallback, allowedPenetration);
}
}
}
}
}
void btCollisionWorld::rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback,short int collisionFilterMask) const
void btCollisionWorld::rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback) const
{
@ -606,7 +606,7 @@ void btCollisionWorld::rayTest(const btVector3& rayFromWorld, const btVector3& r
btCollisionObject* collisionObject= m_collisionObjects[i];
//only perform raycast if filterMask matches
if(collisionObject->getBroadphaseHandle()->m_collisionFilterGroup & collisionFilterMask) {
if(resultCallback.needsCollision(collisionObject->getBroadphaseHandle())) {
//RigidcollisionObject* collisionObject = ctrl->GetRigidcollisionObject();
btVector3 collisionObjectAabbMin,collisionObjectAabbMax;
collisionObject->getCollisionShape()->getAabb(collisionObject->getWorldTransform(),collisionObjectAabbMin,collisionObjectAabbMax);
@ -627,7 +627,7 @@ void btCollisionWorld::rayTest(const btVector3& rayFromWorld, const btVector3& r
}
void btCollisionWorld::convexSweepTest(const btConvexShape* castShape, const btTransform& convexFromWorld, const btTransform& convexToWorld, ConvexResultCallback& resultCallback,short int collisionFilterMask) const
void btCollisionWorld::convexSweepTest(const btConvexShape* castShape, const btTransform& convexFromWorld, const btTransform& convexToWorld, ConvexResultCallback& resultCallback) const
{
btTransform convexFromTrans,convexToTrans;
convexFromTrans = convexFromWorld;
@ -650,7 +650,7 @@ void btCollisionWorld::convexSweepTest(const btConvexShape* castShape, const btT
{
btCollisionObject* collisionObject= m_collisionObjects[i];
//only perform raycast if filterMask matches
if(collisionObject->getBroadphaseHandle()->m_collisionFilterGroup & collisionFilterMask) {
if(resultCallback.needsCollision(collisionObject->getBroadphaseHandle())) {
//RigidcollisionObject* collisionObject = ctrl->GetRigidcollisionObject();
btVector3 collisionObjectAabbMin,collisionObjectAabbMax;
collisionObject->getCollisionShape()->getAabb(collisionObject->getWorldTransform(),collisionObjectAabbMin,collisionObjectAabbMax);
@ -664,8 +664,7 @@ void btCollisionWorld::convexSweepTest(const btConvexShape* castShape, const btT
collisionObject->getCollisionShape(),
collisionObject->getWorldTransform(),
resultCallback,
getDispatchInfo().m_allowedCcdPenetration,
collisionFilterMask);
getDispatchInfo().m_allowedCcdPenetration);
}
}
}

View File

@ -177,21 +177,34 @@ public:
{
btScalar m_closestHitFraction;
btCollisionObject* m_collisionObject;
short int m_collisionFilterGroup;
short int m_collisionFilterMask;
virtual ~RayResultCallback()
{
}
bool HasHit()
bool hasHit()
{
return (m_collisionObject != 0);
}
RayResultCallback()
:m_closestHitFraction(btScalar(1.)),
m_collisionObject(0)
m_collisionObject(0),
m_collisionFilterGroup(btBroadphaseProxy::DefaultFilter),
m_collisionFilterMask(btBroadphaseProxy::AllFilter)
{
}
virtual btScalar AddSingleResult(LocalRayResult& rayResult,bool normalInWorldSpace) = 0;
virtual bool needsCollision(btBroadphaseProxy* proxy0) const
{
bool collides = (proxy0->m_collisionFilterGroup & m_collisionFilterMask) != 0;
collides = collides && (m_collisionFilterGroup & proxy0->m_collisionFilterMask);
return collides;
}
virtual btScalar addSingleResult(LocalRayResult& rayResult,bool normalInWorldSpace) = 0;
};
struct ClosestRayResultCallback : public RayResultCallback
@ -208,7 +221,7 @@ public:
btVector3 m_hitNormalWorld;
btVector3 m_hitPointWorld;
virtual btScalar AddSingleResult(LocalRayResult& rayResult,bool normalInWorldSpace)
virtual btScalar addSingleResult(LocalRayResult& rayResult,bool normalInWorldSpace)
{
//caller already does the filter on the m_closestHitFraction
btAssert(rayResult.m_hitFraction <= m_closestHitFraction);
@ -255,20 +268,36 @@ public:
///RayResultCallback is used to report new raycast results
struct ConvexResultCallback
{
btScalar m_closestHitFraction;
short int m_collisionFilterGroup;
short int m_collisionFilterMask;
ConvexResultCallback()
:m_closestHitFraction(btScalar(1.)),
m_collisionFilterGroup(btBroadphaseProxy::DefaultFilter),
m_collisionFilterMask(btBroadphaseProxy::AllFilter)
{
}
virtual ~ConvexResultCallback()
{
}
btScalar m_closestHitFraction;
bool HasHit()
bool hasHit()
{
return (m_closestHitFraction < btScalar(1.));
}
ConvexResultCallback()
:m_closestHitFraction(btScalar(1.))
virtual bool needsCollision(btBroadphaseProxy* proxy0) const
{
bool collides = (proxy0->m_collisionFilterGroup & m_collisionFilterMask) != 0;
collides = collides && (m_collisionFilterGroup & proxy0->m_collisionFilterMask);
return collides;
}
virtual btScalar AddSingleResult(LocalConvexResult& convexResult,bool normalInWorldSpace) = 0;
virtual btScalar addSingleResult(LocalConvexResult& convexResult,bool normalInWorldSpace) = 0;
};
struct ClosestConvexResultCallback : public ConvexResultCallback
@ -287,7 +316,7 @@ public:
btVector3 m_hitPointWorld;
btCollisionObject* m_hitCollisionObject;
virtual btScalar AddSingleResult(LocalConvexResult& convexResult,bool normalInWorldSpace)
virtual btScalar addSingleResult(LocalConvexResult& convexResult,bool normalInWorldSpace)
{
//caller already does the filter on the m_closestHitFraction
btAssert(convexResult.m_hitFraction <= m_closestHitFraction);
@ -314,11 +343,11 @@ public:
/// rayTest performs a raycast on all objects in the btCollisionWorld, and calls the resultCallback
/// This allows for several queries: first hit, all hits, any hit, dependent on the value returned by the callback.
void rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback, short int collisionFilterMask=-1) const;
void rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback) const;
// convexTest performs a swept convex cast on all objects in the btCollisionWorld, and calls the resultCallback
// This allows for several queries: first hit, all hits, any hit, dependent on the value return by the callback.
void convexSweepTest (const btConvexShape* castShape, const btTransform& from, const btTransform& to, ConvexResultCallback& resultCallback, short int collisionFilterMask=-1) const;
void convexSweepTest (const btConvexShape* castShape, const btTransform& from, const btTransform& to, ConvexResultCallback& resultCallback) const;
/// rayTestSingle performs a raycast call and calls the resultCallback. It is used internally by rayTest.
@ -328,16 +357,16 @@ public:
btCollisionObject* collisionObject,
const btCollisionShape* collisionShape,
const btTransform& colObjWorldTransform,
RayResultCallback& resultCallback, short int collisionFilterMask=-1);
RayResultCallback& resultCallback);
/// objectQuerySingle performs a collision detection query and calls the resultCallback. It is used internally by rayTest.
static void objectQuerySingle(const btConvexShape* castShape, const btTransform& rayFromTrans,const btTransform& rayToTrans,
btCollisionObject* collisionObject,
const btCollisionShape* collisionShape,
const btTransform& colObjWorldTransform,
ConvexResultCallback& resultCallback, btScalar allowedPenetration, short int collisionFilterMask=-1);
ConvexResultCallback& resultCallback, btScalar allowedPenetration);
void addCollisionObject(btCollisionObject* collisionObject,short int collisionFilterGroup=1,short int collisionFilterMask=1);
void addCollisionObject(btCollisionObject* collisionObject,short int collisionFilterGroup=btBroadphaseProxy::DefaultFilter,short int collisionFilterMask=btBroadphaseProxy::AllFilter);
btCollisionObjectArray& getCollisionObjectArray()
{

View File

@ -133,8 +133,8 @@ void btDiscreteDynamicsWorld::debugDrawWorld()
for (int i=0;i<numManifolds;i++)
{
btPersistentManifold* contactManifold = getDispatcher()->getManifoldByIndexInternal(i);
btCollisionObject* obA = static_cast<btCollisionObject*>(contactManifold->getBody0());
btCollisionObject* obB = static_cast<btCollisionObject*>(contactManifold->getBody1());
//btCollisionObject* obA = static_cast<btCollisionObject*>(contactManifold->getBody0());
//btCollisionObject* obB = static_cast<btCollisionObject*>(contactManifold->getBody1());
int numContacts = contactManifold->getNumContacts();
for (int j=0;j<numContacts;j++)

View File

@ -25,7 +25,7 @@ class btConstraintSolver;
class btDynamicsWorld;
/// Type for the callback for each tick
typedef void (*btInternalTickCallback)(const btDynamicsWorld *world, btScalar timeStep);
typedef void (*btInternalTickCallback)(btDynamicsWorld *world, btScalar timeStep);
enum btDynamicsWorldType
{
@ -103,6 +103,11 @@ public:
m_worldUserInfo = worldUserInfo;
}
void setWorldUserInfo(void* worldUserInfo)
{
m_worldUserInfo = worldUserInfo;
}
void* getWorldUserInfo() const
{
return m_worldUserInfo;

View File

@ -712,7 +712,7 @@ void* btDefaultVehicleRaycaster::castRay(const btVector3& from,const btVector3&
m_dynamicsWorld->rayTest(from, to, rayCallback);
if (rayCallback.HasHit())
if (rayCallback.hasHit())
{
btRigidBody* body = btRigidBody::upcast(rayCallback.m_collisionObject);