use camera height instead of player height for underwater check

actorid
scrawl 13 years ago
parent 42c5d515e6
commit 39b3afb98f

@ -154,6 +154,8 @@ void RenderingManager::update (float duration){
mRendering.update(duration); mRendering.update(duration);
mLocalMap->updatePlayer( mRendering.getCamera()->getRealPosition(), mRendering.getCamera()->getRealDirection() ); mLocalMap->updatePlayer( mRendering.getCamera()->getRealPosition(), mRendering.getCamera()->getRealDirection() );
checkUnderwater();
} }
void RenderingManager::waterAdded (MWWorld::Ptr::CellStore *store){ void RenderingManager::waterAdded (MWWorld::Ptr::CellStore *store){
if(store->cell->data.flags & store->cell->HasWater){ if(store->cell->data.flags & store->cell->HasWater){
@ -311,9 +313,9 @@ void RenderingManager::toggleLight()
setAmbientMode(); setAmbientMode();
} }
void RenderingManager::checkUnderwater(float y){ void RenderingManager::checkUnderwater(){
if(mWater){ if(mWater){
mWater->checkUnderwater(y); mWater->checkUnderwater( mRendering.getCamera()->getRealPosition().y );
} }
} }

@ -91,7 +91,7 @@ class RenderingManager: private RenderingInterface {
void moveObject (const MWWorld::Ptr& ptr, const Ogre::Vector3& position); void moveObject (const MWWorld::Ptr& ptr, const Ogre::Vector3& position);
void scaleObject (const MWWorld::Ptr& ptr, const Ogre::Vector3& scale); void scaleObject (const MWWorld::Ptr& ptr, const Ogre::Vector3& scale);
void rotateObject (const MWWorld::Ptr& ptr, const::Ogre::Quaternion& orientation); void rotateObject (const MWWorld::Ptr& ptr, const::Ogre::Quaternion& orientation);
void checkUnderwater(float y); void checkUnderwater();
/// \param store Cell the object was in previously (\a ptr has already been updated to the new cell). /// \param store Cell the object was in previously (\a ptr has already been updated to the new cell).
void moveObjectToCell (const MWWorld::Ptr& ptr, const Ogre::Vector3& position, MWWorld::Ptr::CellStore *store); void moveObjectToCell (const MWWorld::Ptr& ptr, const Ogre::Vector3& position, MWWorld::Ptr::CellStore *store);

@ -535,7 +535,6 @@ namespace MWWorld
{ {
//std::cout << "X:" << ptr.getRefData().getPosition().pos[0] << " Z: " << ptr.getRefData().getPosition().pos[1] << "\n"; //std::cout << "X:" << ptr.getRefData().getPosition().pos[0] << " Z: " << ptr.getRefData().getPosition().pos[1] << "\n";
mRendering->checkUnderwater( ptr.getRefData().getPosition().pos[2]);
Ptr::CellStore *currentCell = mWorldScene->getCurrentCell(); Ptr::CellStore *currentCell = mWorldScene->getCurrentCell();
if (currentCell) if (currentCell)
{ {

Loading…
Cancel
Save