@ -1298,9 +1298,6 @@ namespace MWWorld
{
mPhysics - > updatePosition ( newPtr ) ;
mPhysics - > updatePtr ( ptr , newPtr ) ;
if ( const auto object = mPhysics - > getObject ( newPtr ) )
updateNavigatorObject ( object ) ;
}
}
if ( isPlayer )
@ -1331,17 +1328,9 @@ namespace MWWorld
void World : : scaleObject ( const Ptr & ptr , float scale )
{
if ( mPhysics - > getActor ( ptr ) )
mNavigator - > removeAgent ( getPathfindingHalfExtents ( ptr ) ) ;
ptr . getCellRef ( ) . setScale ( scale ) ;
mWorldScene - > updateObjectScale ( ptr ) ;
if ( mPhysics - > getActor ( ptr ) )
mNavigator - > addAgent ( getPathfindingHalfExtents ( ptr ) ) ;
else if ( const auto object = mPhysics - > getObject ( ptr ) )
mShouldUpdateNavigator = updateNavigatorObject ( object ) | | mShouldUpdateNavigator ;
}
void World : : rotateObjectImp ( const Ptr & ptr , const osg : : Vec3f & rot , bool adjust )
@ -1381,12 +1370,7 @@ namespace MWWorld
ptr . getRefData ( ) . setPosition ( pos ) ;
if ( ptr . getRefData ( ) . getBaseNode ( ) ! = 0 )
{
mWorldScene - > updateObjectRotation ( ptr , true ) ;
if ( const auto object = mPhysics - > getObject ( ptr ) )
updateNavigatorObject ( object ) ;
}
}
void World : : adjustPosition ( const Ptr & ptr , bool force )
@ -1580,20 +1564,19 @@ namespace MWWorld
void World : : updateNavigator ( )
{
bool updated = false ;
mPhysics - > forEachAnimatedObject ( [ & ] ( const MWPhysics : : Object * object )
{
mShouldUpdateNavigator = updateNavigatorObject ( object ) | | mShouldUpdateNavigator ;
updated = updateNavigatorObject ( object ) | | updated ;
} ) ;
for ( const auto & door : mDoorStates )
if ( const auto object = mPhysics - > getObject ( door . first ) )
mShouldUpdateNavigator = updateNavigatorObject ( object ) | | mShouldUpdateNavigator ;
updated = updateNavigatorObject ( object ) | | updated ;
if ( mShouldUpdateNavigator )
{
if ( updated )
mNavigator - > update ( getPlayerPtr ( ) . getRefData ( ) . getPosition ( ) . asVec3 ( ) ) ;
mShouldUpdateNavigator = false ;
}
}
bool World : : updateNavigatorObject ( const MWPhysics : : Object * object )
@ -2425,7 +2408,7 @@ namespace MWWorld
{
// Remove the old CharacterController
MWBase : : Environment : : get ( ) . getMechanicsManager ( ) - > remove ( getPlayerPtr ( ) ) ;
mNavigator - > removeAgent ( getPathfindingHalfExtents( getPlayerConst Ptr( ) ) ) ;
mNavigator - > removeAgent ( mPhysics- > getHalfExtents ( getPlayer Ptr( ) ) ) ;
mPhysics - > remove ( getPlayerPtr ( ) ) ;
mRendering - > removePlayer ( getPlayerPtr ( ) ) ;
@ -2460,8 +2443,7 @@ namespace MWWorld
applyLoopingParticles ( player ) ;
mDefaultHalfExtents = mPhysics - > getOriginalHalfExtents ( getPlayerPtr ( ) ) ;
mNavigator - > addAgent ( getPathfindingHalfExtents ( getPlayerConstPtr ( ) ) ) ;
mNavigator - > addAgent ( mPhysics - > getHalfExtents ( getPlayerPtr ( ) ) ) ;
}
World : : RestPermitted World : : canRest ( ) const
@ -3436,11 +3418,6 @@ namespace MWWorld
return mPlayer - > getPlayer ( ) ;
}
MWWorld : : ConstPtr World : : getPlayerConstPtr ( ) const
{
return mPlayer - > getConstPlayer ( ) ;
}
void World : : updateDialogueGlobals ( )
{
MWWorld : : Ptr player = getPlayerPtr ( ) ;
@ -3810,12 +3787,4 @@ namespace MWWorld
mRendering - > setNavMeshNumber ( value ) ;
}
osg : : Vec3f World : : getPathfindingHalfExtents ( const MWWorld : : ConstPtr & actor ) const
{
if ( actor . getCell ( ) - > isExterior ( ) )
return mDefaultHalfExtents ; // Using default half extents for better performance
else
return getHalfExtents ( actor ) ;
}
}