1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Restore old ground check

This commit is contained in:
Chris Robinson 2013-02-06 21:57:59 -08:00
parent 923d0d6eb4
commit 8de2d24d0e
2 changed files with 5 additions and 6 deletions

View File

@ -132,7 +132,6 @@ namespace MWWorld
Ogre::Vector3 up(0.0f, 0.0f, 1.0f);
Ogre::Vector3 newPosition = position;
bool onground = false;
if(gravity)
{
newtrace(&trace, position, position+Ogre::Vector3(0,0,-10), halfExtents, verticalRotation, isInterior, engine);
@ -162,8 +161,7 @@ namespace MWWorld
if(trace.fraction < 1.0f)
{
//std::cout<<"angle: "<<getSlope(trace.planenormal)<<"\n";
onground = getSlope(currentNormal) <= sMaxSlope;
if(!onground || currentNormal == lastNormal)
if(getSlope(currentNormal) > sMaxSlope || currentNormal == lastNormal)
{
if(!stepMove(newPosition, velocity, remainingTime, verticalRotation, halfExtents, isInterior, engine))
{
@ -190,7 +188,6 @@ namespace MWWorld
verticalVelocity = clippedVelocity.z;
physicActor->setVerticalForce(verticalVelocity - time*400.0f);
physicActor->setOnGround(onground);
return newPosition;
}

View File

@ -1369,10 +1369,12 @@ namespace MWWorld
Ptr::CellStore *currentCell = mWorldScene->getCurrentCell();
RefData &refdata = mPlayer->getPlayer().getRefData();
const OEngine::Physic::PhysicActor *physact = mPhysEngine->getCharacter(refdata.getHandle());
Ogre::Vector3 playerPos(refdata.getPosition().pos);
if(!physact->getOnGround() || isUnderwater(*currentCell->mCell, playerPos))
std::pair<bool,Ogre::Vector3> hit = mPhysics->castRay(playerPos, Ogre::Vector3(0,0,-1), 50);
bool isOnGround = (hit.first ? (hit.second.distance (playerPos) < 25) : false);
if(!isOnGround || isUnderwater(*currentCell->mCell, playerPos))
return 2;
if((currentCell->mCell->mData.mFlags&ESM::Cell::NoSleep))