|
|
|
@ -488,7 +488,7 @@ namespace Physic
|
|
|
|
|
dynamicsWorld->rayTest(from, to, resultCallback1);
|
|
|
|
|
if (resultCallback1.hasHit())
|
|
|
|
|
{
|
|
|
|
|
name = static_cast<RigidBody&>(*resultCallback1.m_collisionObject).mName;
|
|
|
|
|
name = static_cast<const RigidBody&>(*resultCallback1.m_collisionObject).mName;
|
|
|
|
|
d1 = resultCallback1.m_closestHitFraction;
|
|
|
|
|
d = d1;
|
|
|
|
|
}
|
|
|
|
@ -502,7 +502,7 @@ namespace Physic
|
|
|
|
|
d2 = resultCallback1.m_closestHitFraction;
|
|
|
|
|
if(d2<=d1)
|
|
|
|
|
{
|
|
|
|
|
name = static_cast<PairCachingGhostObject&>(*resultCallback2.m_collisionObject).mName;
|
|
|
|
|
name = static_cast<const PairCachingGhostObject&>(*resultCallback2.m_collisionObject).mName;
|
|
|
|
|
d = d2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -515,25 +515,25 @@ namespace Physic
|
|
|
|
|
MyRayResultCallback resultCallback1;
|
|
|
|
|
resultCallback1.m_collisionFilterMask = COL_WORLD|COL_RAYCASTING;
|
|
|
|
|
dynamicsWorld->rayTest(from, to, resultCallback1);
|
|
|
|
|
std::vector< std::pair<float, btCollisionObject*> > results = resultCallback1.results;
|
|
|
|
|
std::vector< std::pair<float, const btCollisionObject*> > results = resultCallback1.results;
|
|
|
|
|
|
|
|
|
|
MyRayResultCallback resultCallback2;
|
|
|
|
|
resultCallback2.m_collisionFilterMask = COL_ACTOR_INTERNAL|COL_ACTOR_EXTERNAL;
|
|
|
|
|
dynamicsWorld->rayTest(from, to, resultCallback2);
|
|
|
|
|
std::vector< std::pair<float, btCollisionObject*> > actorResults = resultCallback2.results;
|
|
|
|
|
std::vector< std::pair<float, const btCollisionObject*> > actorResults = resultCallback2.results;
|
|
|
|
|
|
|
|
|
|
std::vector< std::pair<float, std::string> > results2;
|
|
|
|
|
|
|
|
|
|
for (std::vector< std::pair<float, btCollisionObject*> >::iterator it=results.begin();
|
|
|
|
|
for (std::vector< std::pair<float, const btCollisionObject*> >::iterator it=results.begin();
|
|
|
|
|
it != results.end(); ++it)
|
|
|
|
|
{
|
|
|
|
|
results2.push_back( std::make_pair( (*it).first, static_cast<RigidBody&>(*(*it).second).mName ) );
|
|
|
|
|
results2.push_back( std::make_pair( (*it).first, static_cast<const RigidBody&>(*(*it).second).mName ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (std::vector< std::pair<float, btCollisionObject*> >::iterator it=actorResults.begin();
|
|
|
|
|
for (std::vector< std::pair<float, const btCollisionObject*> >::iterator it=actorResults.begin();
|
|
|
|
|
it != actorResults.end(); ++it)
|
|
|
|
|
{
|
|
|
|
|
results2.push_back( std::make_pair( (*it).first, static_cast<PairCachingGhostObject&>(*(*it).second).mName ) );
|
|
|
|
|
results2.push_back( std::make_pair( (*it).first, static_cast<const PairCachingGhostObject&>(*(*it).second).mName ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::sort(results2.begin(), results2.end(), MyRayResultCallback::cmp);
|
|
|
|
|