mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-31 23:45:32 +00:00
Cleaned up more inaccurate comments.
This commit is contained in:
parent
f57c11254f
commit
f71fb83bfc
1 changed files with 7 additions and 14 deletions
|
@ -116,9 +116,8 @@ namespace MWWorld
|
||||||
const ESM::Position &refpos = ptr.getRefData().getPosition();
|
const ESM::Position &refpos = ptr.getRefData().getPosition();
|
||||||
Ogre::Vector3 position(refpos.pos);
|
Ogre::Vector3 position(refpos.pos);
|
||||||
|
|
||||||
|
/* Anything to collide with? */
|
||||||
OEngine::Physic::PhysicActor *physicActor = engine->getCharacter(ptr.getRefData().getHandle());
|
OEngine::Physic::PhysicActor *physicActor = engine->getCharacter(ptr.getRefData().getHandle());
|
||||||
|
|
||||||
// If no need to check for collision simply return the new position.
|
|
||||||
if(!physicActor || !physicActor->getCollisionMode())
|
if(!physicActor || !physicActor->getCollisionMode())
|
||||||
{
|
{
|
||||||
return position + (Ogre::Quaternion(Ogre::Radian(refpos.rot[2]), Ogre::Vector3::NEGATIVE_UNIT_Z) *
|
return position + (Ogre::Quaternion(Ogre::Radian(refpos.rot[2]), Ogre::Vector3::NEGATIVE_UNIT_Z) *
|
||||||
|
@ -126,10 +125,10 @@ namespace MWWorld
|
||||||
* movement * time;
|
* movement * time;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Anything to collide with? */
|
|
||||||
btCollisionObject *colobj = physicActor->getCollisionBody();
|
btCollisionObject *colobj = physicActor->getCollisionBody();
|
||||||
Ogre::Vector3 halfExtents = physicActor->getHalfExtents();
|
Ogre::Vector3 halfExtents = physicActor->getHalfExtents();
|
||||||
position.z += halfExtents.z;
|
position.z += halfExtents.z;
|
||||||
|
|
||||||
waterlevel -= halfExtents.z * 0.5;
|
waterlevel -= halfExtents.z * 0.5;
|
||||||
/*
|
/*
|
||||||
* A 3/4 submerged example
|
* A 3/4 submerged example
|
||||||
|
@ -155,13 +154,7 @@ namespace MWWorld
|
||||||
bool isBipedal = ptr.getClass().isBipedal(ptr);
|
bool isBipedal = ptr.getClass().isBipedal(ptr);
|
||||||
bool isNpc = ptr.getClass().isNpc();
|
bool isNpc = ptr.getClass().isNpc();
|
||||||
|
|
||||||
//if(!canWalk && !isBipedal && !isNpc && (position.z >= waterlevel))
|
if(position.z < waterlevel || isFlying) // under water by 3/4 or can fly
|
||||||
//{
|
|
||||||
//std::cout << "Swim Creature \""<<ptr.getClass().getName(ptr)<<"\""
|
|
||||||
//<< " above waterline, z pos = "<<std::to_string(position.z ) << std::endl;
|
|
||||||
//}
|
|
||||||
|
|
||||||
if(position.z < waterlevel || isFlying) // under water by any amount or can fly
|
|
||||||
{
|
{
|
||||||
// TODO: Shouldn't water have higher drag in calculating velocity?
|
// TODO: Shouldn't water have higher drag in calculating velocity?
|
||||||
velocity = (Ogre::Quaternion(Ogre::Radian(refpos.rot[2]), Ogre::Vector3::NEGATIVE_UNIT_Z)*
|
velocity = (Ogre::Quaternion(Ogre::Radian(refpos.rot[2]), Ogre::Vector3::NEGATIVE_UNIT_Z)*
|
||||||
|
@ -206,9 +199,9 @@ namespace MWWorld
|
||||||
Ogre::Vector3 nextpos = newPosition + velocity * remainingTime;
|
Ogre::Vector3 nextpos = newPosition + velocity * remainingTime;
|
||||||
|
|
||||||
// If not able to fly, walk or bipedal don't allow to move out of water
|
// If not able to fly, walk or bipedal don't allow to move out of water
|
||||||
// FIXME: this if condition may not work for large creatures or situations
|
// TODO: this if condition may not work for large creatures or situations
|
||||||
// where the creature gets above the waterline for some reason
|
// where the creature gets above the waterline for some reason
|
||||||
if(newPosition.z < waterlevel && // started fully under water
|
if(newPosition.z < waterlevel && // started 3/4 under water
|
||||||
!isFlying && // can't fly
|
!isFlying && // can't fly
|
||||||
!canWalk && // can't walk
|
!canWalk && // can't walk
|
||||||
!isBipedal && // not bipedal (assume bipedals can walk)
|
!isBipedal && // not bipedal (assume bipedals can walk)
|
||||||
|
@ -221,7 +214,7 @@ namespace MWWorld
|
||||||
Ogre::Vector3 reflectdir = velocity.reflect(down);
|
Ogre::Vector3 reflectdir = velocity.reflect(down);
|
||||||
reflectdir.normalise();
|
reflectdir.normalise();
|
||||||
velocity = slide(reflectdir, down)*movelen;
|
velocity = slide(reflectdir, down)*movelen;
|
||||||
// FIXME: remainingTime is unchanged before the loop continues
|
// NOTE: remainingTime is unchanged before the loop continues
|
||||||
continue; // velocity updated, calculate nextpos again
|
continue; // velocity updated, calculate nextpos again
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,7 +225,7 @@ namespace MWWorld
|
||||||
if(tracer.mFraction >= 1.0f)
|
if(tracer.mFraction >= 1.0f)
|
||||||
{
|
{
|
||||||
newPosition = tracer.mEndPos; // ok to move, so set newPosition
|
newPosition = tracer.mEndPos; // ok to move, so set newPosition
|
||||||
remainingTime *= (1.0f-tracer.mFraction); // TODO: remainingTime is no longer used so don't set it?
|
remainingTime *= (1.0f-tracer.mFraction); // FIXME: remainingTime is no longer used so don't set it?
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue