diff --git a/code/ryzom/client/src/camera_animation_manager/camera_animation_info.h b/code/ryzom/client/src/camera_animation_manager/camera_animation_info.h index 869d07d45..f2ad736f7 100644 --- a/code/ryzom/client/src/camera_animation_manager/camera_animation_info.h +++ b/code/ryzom/client/src/camera_animation_manager/camera_animation_info.h @@ -46,6 +46,7 @@ struct TCameraAnimationInputInfo { TCameraAnimationInputInfo(const NLMISC::CVector& currCamPos, const NLMISC::CVector& currCamLookAtDir, const NLMISC::CVector& startCamPos, const NLMISC::CVector& startCamLookAtDir, + const NLMISC::CVector& animStartCamPos, const NLMISC::CVector& animStartCamLookAtDir, float elapsedTimeSinceStartStep) { CamPos = currCamPos; @@ -54,6 +55,9 @@ struct TCameraAnimationInputInfo StartCamPos = startCamPos; StartCamLookAtDir = startCamLookAtDir; + AnimStartCamPos = startCamPos; + AnimStartCamLookAtDir = startCamLookAtDir; + ElapsedTimeSinceStartStep = elapsedTimeSinceStartStep; } @@ -65,6 +69,9 @@ struct TCameraAnimationInputInfo StartCamPos = input.StartCamPos; StartCamLookAtDir = input.StartCamLookAtDir; + AnimStartCamPos = input.AnimStartCamPos; + AnimStartCamLookAtDir = input.AnimStartCamLookAtDir; + ElapsedTimeSinceStartStep = input.ElapsedTimeSinceStartStep; } @@ -82,6 +89,9 @@ struct TCameraAnimationInputInfo NLMISC::CVector StartCamPos; /// Start camera position NLMISC::CVector StartCamLookAtDir; /// Start camera look at direction + NLMISC::CVector AnimStartCamPos; /// Camera position at animation start + NLMISC::CVector AnimStartCamLookAtDir; /// Camera look at direction an animation start + float ElapsedTimeSinceStartStep; /// Elapsed time in second since the beginning of this step }; diff --git a/code/ryzom/client/src/camera_animation_manager/camera_animation_player.cpp b/code/ryzom/client/src/camera_animation_manager/camera_animation_player.cpp index b4f4ec3b6..8e58adff5 100644 --- a/code/ryzom/client/src/camera_animation_manager/camera_animation_player.cpp +++ b/code/ryzom/client/src/camera_animation_manager/camera_animation_player.cpp @@ -131,7 +131,9 @@ TCameraAnimationOutputInfo CCameraAnimationPlayer::update() NLMISC::CVector currLookAtDir = View.currentView(); TCameraAnimationInputInfo currCamInfo(currCamPos, currLookAtDir, - _StartStepCamPos, _StartStepCamLookAtDir, _ElapsedTimeForCurrStep); + _StartStepCamPos, _StartStepCamLookAtDir, + _LastViewPos, _LastView, + _ElapsedTimeForCurrStep); if (!isPlaying()) return currCamInfo.toOutput(); 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 b3cdb87e3..38b1b09da 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 @@ -357,7 +357,21 @@ public: /// Function that plays the step virtual TCameraAnimationOutputInfo updateStep(const TCameraAnimationInputInfo& currCamInfo) { - return currCamInfo.toOutput(); + TCameraAnimationOutputInfo camInfo; + + float ratio = currCamInfo.ElapsedTimeSinceStartStep / getDuration(); + + // We compute the current position between the starting position and the final position + NLMISC::CVector movementVector = resolvePositionOrEntityPosition(currCamInfo.AnimStartCamPos) - currCamInfo.StartCamPos; + + // We current position is computed using the ratio and the starting position + NLMISC::CVector offset = movementVector * ratio; + camInfo.CamPos = currCamInfo.StartCamPos + offset; + + // We get the current look at direction + camInfo.CamLookAtDir = computeCurrentLookAtDir(ratio, currCamInfo.StartCamLookAtDir, currCamInfo.AnimStartCamLookAtDir); + + return camInfo; } virtual void stopStep()