Start trace from collision object origin

pull/100/head^2
Assumeru 8 years ago
parent 99bc4f733f
commit 05cc258ed3

@ -1328,10 +1328,12 @@ namespace MWPhysics
waterCollision = true;
else if (physicActor->getCollisionMode())
{
const float halfZ = physicActor->getHalfExtents().z();
const osg::Vec3f actorPosition = physicActor->getPosition();
const osg::Vec3f destinationPosition(actorPosition.x(), actorPosition.y(), waterlevel + physicActor->getHalfExtents().z());
const osg::Vec3f startingPosition(actorPosition.x(), actorPosition.y(), actorPosition.z() + halfZ);
const osg::Vec3f destinationPosition(actorPosition.x(), actorPosition.y(), waterlevel + halfZ);
ActorTracer tracer;
tracer.doTrace(physicActor->getCollisionObject(), actorPosition, destinationPosition, mCollisionWorld);
tracer.doTrace(physicActor->getCollisionObject(), startingPosition, destinationPosition, mCollisionWorld);
if (tracer.mFraction >= 1.0f)
{
waterCollision = true;

Loading…
Cancel
Save