mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-29 16:11:37 -04:00
Partially revert 682f30ef9c7e8edad3e825be6920670ffac3bdce
This change made dead netch fall through the floor, because the animation moves the creature *below* its external collision box.
This commit is contained in:
parent
75f11f781c
commit
66925be440
@ -240,8 +240,6 @@ namespace MWPhysics
|
|||||||
const ESM::Position& refpos = ptr.getRefData().getPosition();
|
const ESM::Position& refpos = ptr.getRefData().getPosition();
|
||||||
osg::Vec3f position(refpos.asVec3());
|
osg::Vec3f position(refpos.asVec3());
|
||||||
|
|
||||||
float collisionShapeOffset = physicActor->getPosition().z() - position.z();
|
|
||||||
|
|
||||||
// Early-out for totally static creatures
|
// Early-out for totally static creatures
|
||||||
// (Not sure if gravity should still apply?)
|
// (Not sure if gravity should still apply?)
|
||||||
if (!ptr.getClass().isMobile(ptr))
|
if (!ptr.getClass().isMobile(ptr))
|
||||||
@ -258,11 +256,17 @@ namespace MWPhysics
|
|||||||
}
|
}
|
||||||
|
|
||||||
btCollisionObject *colobj = physicActor->getCollisionObject();
|
btCollisionObject *colobj = physicActor->getCollisionObject();
|
||||||
position.z() += collisionShapeOffset;
|
osg::Vec3f halfExtents = physicActor->getHalfExtents();
|
||||||
|
|
||||||
|
// NOTE: here we don't account for the collision box translation (i.e. physicActor->getPosition() - refpos.pos).
|
||||||
|
// That means the collision shape used for moving this actor is in a different spot than the collision shape
|
||||||
|
// other actors are using to collide against this actor.
|
||||||
|
// While this is strictly speaking wrong, it's needed for MW compatibility.
|
||||||
|
position.z() += halfExtents.z();
|
||||||
|
|
||||||
static const float fSwimHeightScale = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
|
static const float fSwimHeightScale = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
|
||||||
.find("fSwimHeightScale")->getFloat();
|
.find("fSwimHeightScale")->getFloat();
|
||||||
float swimlevel = waterlevel + collisionShapeOffset - (physicActor->getRenderingHalfExtents().z() * 2 * fSwimHeightScale);
|
float swimlevel = waterlevel + halfExtents.z() - (physicActor->getRenderingHalfExtents().z() * 2 * fSwimHeightScale);
|
||||||
|
|
||||||
ActorTracer tracer;
|
ActorTracer tracer;
|
||||||
osg::Vec3f inertia = physicActor->getInertialForce();
|
osg::Vec3f inertia = physicActor->getInertialForce();
|
||||||
@ -370,7 +374,7 @@ namespace MWPhysics
|
|||||||
{
|
{
|
||||||
// don't let pure water creatures move out of water after stepMove
|
// don't let pure water creatures move out of water after stepMove
|
||||||
if (ptr.getClass().isPureWaterCreature(ptr)
|
if (ptr.getClass().isPureWaterCreature(ptr)
|
||||||
&& newPosition.z() + physicActor->getHalfExtents().z() > waterlevel)
|
&& newPosition.z() + halfExtents.z() > waterlevel)
|
||||||
newPosition = oldPosition;
|
newPosition = oldPosition;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -451,7 +455,7 @@ namespace MWPhysics
|
|||||||
}
|
}
|
||||||
physicActor->setOnGround(isOnGround);
|
physicActor->setOnGround(isOnGround);
|
||||||
|
|
||||||
newPosition.z() -= collisionShapeOffset; // remove what was added at the beginning
|
newPosition.z() -= halfExtents.z(); // remove what was added at the beginning
|
||||||
return newPosition;
|
return newPosition;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user