diff --git a/code/ryzom/client/src/camera_animation_manager/camera_animation_step_player_factory.cpp b/code/ryzom/client/src/camera_animation_manager/camera_animation_step_player_factory.cpp index c5c5c6db5..8acaf9a4b 100644 --- a/code/ryzom/client/src/camera_animation_manager/camera_animation_step_player_factory.cpp +++ b/code/ryzom/client/src/camera_animation_manager/camera_animation_step_player_factory.cpp @@ -123,7 +123,7 @@ void ICameraAnimationStepPlayer::stopStepAndModifiers() } } -NLMISC::CVector ICameraAnimationStepPlayer::computeCurrentLookAtDir(float ratio, const NLMISC::CVector& currPos, const NLMISC::CVector& startLookAtDir, +NLMISC::CVector ICameraAnimationStepPlayer::computeCurrentLookAtDir(float ratio, const NLMISC::CVector& startLookAtDir, const NLMISC::CVector& endLookAtDir) { // We normalize the start look at direction diff --git a/code/ryzom/client/src/camera_animation_manager/camera_animation_step_player_factory.h b/code/ryzom/client/src/camera_animation_manager/camera_animation_step_player_factory.h index bd54bc73b..11170e85b 100644 --- a/code/ryzom/client/src/camera_animation_manager/camera_animation_step_player_factory.h +++ b/code/ryzom/client/src/camera_animation_manager/camera_animation_step_player_factory.h @@ -59,10 +59,10 @@ public: protected: - /// Compute the current look at direction depending on the current position, the starting look at direction, + /// Compute the current look at direction depending on the starting look at direction, /// the ending look at direction and the progression expressed as a ratio (value between 0 and 1 that expresses the /// progression) - NLMISC::CVector computeCurrentLookAtDir(float ratio, const NLMISC::CVector& currPos, const NLMISC::CVector& startLookAtDir, + NLMISC::CVector computeCurrentLookAtDir(float ratio, const NLMISC::CVector& startLookAtDir, const NLMISC::CVector& endLookAtDir); // The list of modifiers diff --git a/code/ryzom/client/src/camera_animation_manager/camera_animation_steps_players.cpp b/code/ryzom/client/src/camera_animation_manager/camera_animation_steps_players.cpp index 755940f40..119872fa5 100644 --- a/code/ryzom/client/src/camera_animation_manager/camera_animation_steps_players.cpp +++ b/code/ryzom/client/src/camera_animation_manager/camera_animation_steps_players.cpp @@ -83,10 +83,10 @@ public: float ratio = currCamInfo.ElapsedTimeSinceStartStep / getDuration(); // We compute the final look at direction - NLMISC::CVector finalDir = resolvePositionOrEntityPosition(LookAtPos) - currCamInfo.CamPos; + NLMISC::CVector finalDir = resolvePositionOrEntityPosition(LookAtPos) - camInfo.CamPos; // We get the current look at direction - camInfo.CamLookAtDir = computeCurrentLookAtDir(ratio, camInfo.CamPos, currCamInfo.CamLookAtDir, finalDir); + camInfo.CamLookAtDir = computeCurrentLookAtDir(ratio, currCamInfo.CamLookAtDir, finalDir); return camInfo; } @@ -123,7 +123,24 @@ public: /// Function that plays the step virtual TCameraAnimationInfo updateStep(const TCameraAnimationInfo& currCamInfo) { - return currCamInfo; + TCameraAnimationInfo camInfo; + + float ratio = currCamInfo.ElapsedTimeSinceStartStep / getDuration(); + + // We compute the current position between the starting position and the final position + NLMISC::CVector movementVector = resolvePositionOrEntityPosition(EndPos) - currCamInfo.CamPos; + + // We current position is computed using the ratio and the starting position + NLMISC::CVector offset = movementVector * ratio; + camInfo.CamPos = currCamInfo.CamPos + offset; + + // Now we compute the current look at direction + NLMISC::CVector finalDir = resolvePositionOrEntityPosition(LookAtPos) - camInfo.CamPos; + + // We get the current look at direction + camInfo.CamLookAtDir = computeCurrentLookAtDir(ratio, currCamInfo.CamLookAtDir, finalDir); + + return camInfo; } virtual void stopStep()