mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-01 20:49:41 +00:00
Visualize hand to hand hits
This commit is contained in:
parent
435b2e37f8
commit
574ccbf7bd
3 changed files with 6 additions and 0 deletions
|
@ -39,6 +39,7 @@ namespace MWPhysics
|
||||||
mObject = collisionObject;
|
mObject = collisionObject;
|
||||||
mLeastDistSqr = distsqr;
|
mLeastDistSqr = distsqr;
|
||||||
mContactPoint = cp.getPositionWorldOnA();
|
mContactPoint = cp.getPositionWorldOnA();
|
||||||
|
mContactNormal = cp.m_normalWorldOnB;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ namespace MWPhysics
|
||||||
public:
|
public:
|
||||||
const btCollisionObject *mObject{nullptr};
|
const btCollisionObject *mObject{nullptr};
|
||||||
btVector3 mContactPoint{0,0,0};
|
btVector3 mContactPoint{0,0,0};
|
||||||
|
btVector3 mContactNormal{0,0,0};
|
||||||
btScalar mLeastDistSqr;
|
btScalar mLeastDistSqr;
|
||||||
|
|
||||||
DeepestNotMeContactTestResultCallback(const btCollisionObject* me, const std::vector<const btCollisionObject*>& targets, const btVector3 &origin);
|
DeepestNotMeContactTestResultCallback(const btCollisionObject* me, const std::vector<const btCollisionObject*>& targets, const btVector3 &origin);
|
||||||
|
|
|
@ -173,6 +173,7 @@ namespace MWPhysics
|
||||||
|
|
||||||
if (result.mHit)
|
if (result.mHit)
|
||||||
{
|
{
|
||||||
|
reportCollision(Misc::Convert::toBullet(result.mHitPos), Misc::Convert::toBullet(result.mHitNormal));
|
||||||
return std::make_pair(result.mHitObject, result.mHitPos);
|
return std::make_pair(result.mHitObject, result.mHitPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +218,10 @@ namespace MWPhysics
|
||||||
{
|
{
|
||||||
PtrHolder* holder = static_cast<PtrHolder*>(resultCallback.mObject->getUserPointer());
|
PtrHolder* holder = static_cast<PtrHolder*>(resultCallback.mObject->getUserPointer());
|
||||||
if (holder)
|
if (holder)
|
||||||
|
{
|
||||||
|
reportCollision(resultCallback.mContactPoint, resultCallback.mContactNormal);
|
||||||
return std::make_pair(holder->getPtr(), Misc::Convert::toOsg(resultCallback.mContactPoint));
|
return std::make_pair(holder->getPtr(), Misc::Convert::toOsg(resultCallback.mContactPoint));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return std::make_pair(MWWorld::Ptr(), osg::Vec3f());
|
return std::make_pair(MWWorld::Ptr(), osg::Vec3f());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue