1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-13 22:39:44 +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 up(0.0f, 0.0f, 1.0f);
Ogre::Vector3 newPosition = position; Ogre::Vector3 newPosition = position;
bool onground = false;
if(gravity) if(gravity)
{ {
newtrace(&trace, position, position+Ogre::Vector3(0,0,-10), halfExtents, verticalRotation, isInterior, engine); newtrace(&trace, position, position+Ogre::Vector3(0,0,-10), halfExtents, verticalRotation, isInterior, engine);
@ -162,8 +161,7 @@ namespace MWWorld
if(trace.fraction < 1.0f) if(trace.fraction < 1.0f)
{ {
//std::cout<<"angle: "<<getSlope(trace.planenormal)<<"\n"; //std::cout<<"angle: "<<getSlope(trace.planenormal)<<"\n";
onground = getSlope(currentNormal) <= sMaxSlope; if(getSlope(currentNormal) > sMaxSlope || currentNormal == lastNormal)
if(!onground || currentNormal == lastNormal)
{ {
if(!stepMove(newPosition, velocity, remainingTime, verticalRotation, halfExtents, isInterior, engine)) if(!stepMove(newPosition, velocity, remainingTime, verticalRotation, halfExtents, isInterior, engine))
{ {
@ -190,7 +188,6 @@ namespace MWWorld
verticalVelocity = clippedVelocity.z; verticalVelocity = clippedVelocity.z;
physicActor->setVerticalForce(verticalVelocity - time*400.0f); physicActor->setVerticalForce(verticalVelocity - time*400.0f);
physicActor->setOnGround(onground);
return newPosition; return newPosition;
} }

View file

@ -1369,10 +1369,12 @@ namespace MWWorld
Ptr::CellStore *currentCell = mWorldScene->getCurrentCell(); Ptr::CellStore *currentCell = mWorldScene->getCurrentCell();
RefData &refdata = mPlayer->getPlayer().getRefData(); RefData &refdata = mPlayer->getPlayer().getRefData();
const OEngine::Physic::PhysicActor *physact = mPhysEngine->getCharacter(refdata.getHandle());
Ogre::Vector3 playerPos(refdata.getPosition().pos); 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; return 2;
if((currentCell->mCell->mData.mFlags&ESM::Cell::NoSleep)) if((currentCell->mCell->mData.mFlags&ESM::Cell::NoSleep))