|
|
|
@ -16,7 +16,7 @@ namespace MWPhysics
|
|
|
|
|
class ClosestNotMeConvexResultCallback : public btCollisionWorld::ClosestConvexResultCallback
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ClosestNotMeConvexResultCallback(btCollisionObject *me, const btVector3 &up, btScalar minSlopeDot)
|
|
|
|
|
ClosestNotMeConvexResultCallback(const btCollisionObject *me, const btVector3 &up, btScalar minSlopeDot)
|
|
|
|
|
: btCollisionWorld::ClosestConvexResultCallback(btVector3(0.0, 0.0, 0.0), btVector3(0.0, 0.0, 0.0)),
|
|
|
|
|
mMe(me), mUp(up), mMinSlopeDot(minSlopeDot)
|
|
|
|
|
{
|
|
|
|
@ -44,13 +44,13 @@ public:
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
btCollisionObject *mMe;
|
|
|
|
|
const btCollisionObject *mMe;
|
|
|
|
|
const btVector3 mUp;
|
|
|
|
|
const btScalar mMinSlopeDot;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ActorTracer::doTrace(btCollisionObject *actor, const osg::Vec3f& start, const osg::Vec3f& end, btCollisionWorld* world)
|
|
|
|
|
void ActorTracer::doTrace(const btCollisionObject *actor, const osg::Vec3f& start, const osg::Vec3f& end, const btCollisionWorld* world)
|
|
|
|
|
{
|
|
|
|
|
const btVector3 btstart = toBullet(start);
|
|
|
|
|
const btVector3 btend = toBullet(end);
|
|
|
|
@ -66,9 +66,9 @@ void ActorTracer::doTrace(btCollisionObject *actor, const osg::Vec3f& start, con
|
|
|
|
|
newTraceCallback.m_collisionFilterGroup = actor->getBroadphaseHandle()->m_collisionFilterGroup;
|
|
|
|
|
newTraceCallback.m_collisionFilterMask = actor->getBroadphaseHandle()->m_collisionFilterMask;
|
|
|
|
|
|
|
|
|
|
btCollisionShape *shape = actor->getCollisionShape();
|
|
|
|
|
const btCollisionShape *shape = actor->getCollisionShape();
|
|
|
|
|
assert(shape->isConvex());
|
|
|
|
|
world->convexSweepTest(static_cast<btConvexShape*>(shape),
|
|
|
|
|
world->convexSweepTest(static_cast<const btConvexShape*>(shape),
|
|
|
|
|
from, to, newTraceCallback);
|
|
|
|
|
|
|
|
|
|
// Copy the hit data over to our trace results struct:
|
|
|
|
@ -89,7 +89,7 @@ void ActorTracer::doTrace(btCollisionObject *actor, const osg::Vec3f& start, con
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ActorTracer::findGround(const Actor* actor, const osg::Vec3f& start, const osg::Vec3f& end, btCollisionWorld* world)
|
|
|
|
|
void ActorTracer::findGround(const Actor* actor, const osg::Vec3f& start, const osg::Vec3f& end, const btCollisionWorld* world)
|
|
|
|
|
{
|
|
|
|
|
const btVector3 btstart(start.x(), start.y(), start.z()+1.0f);
|
|
|
|
|
const btVector3 btend(end.x(), end.y(), end.z()+1.0f);
|
|
|
|
|