From c29dc1bf43f485f3493208a57e56491e0f175058 Mon Sep 17 00:00:00 2001 From: Fabien_HENON Date: Wed, 8 Aug 2012 22:30:32 +0200 Subject: [PATCH] Added: #1469 Implementation of the static step --HG-- branch : gsoc2012-fabien --- .../camera_animation_steps_players.cpp | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) 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 097bd1ae2..d2dba764f 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 @@ -75,7 +75,35 @@ public: /// Function that plays the step virtual TCameraAnimationInfo updateStep(const TCameraAnimationInfo& currCamInfo) { - return currCamInfo; + TCameraAnimationInfo camInfo; + + // We don't change the position + camInfo.CamPos = currCamInfo.CamPos; + + float ratio = currCamInfo.ElapsedTimeSinceStartStep / getDuration(); + + // We compute the starting look at direction + NLMISC::CVector startDir = currCamInfo.CamLookAtDir - currCamInfo.CamPos; + startDir.normalize(); + + // We compute the final look at direction + NLMISC::CVector finalDir = resolvePositionOrEntityPosition(LookAtPos) - currCamInfo.CamPos; + finalDir.normalize(); + + // We compute a vector that goes from the starting look at dir to the final look at dir + NLMISC::CVector startToFinal = finalDir - startDir; + + // We multiply this vector by the ratio so that we can have a vector that represent the current position we are looking at + startToFinal = startToFinal * ratio; + + // We compute the position we are looking at + NLMISC::CVector currLookAtPos = startDir + startToFinal; + + // We compute the direction + camInfo.CamLookAtDir = currLookAtPos - camInfo.CamPos; + camInfo.CamLookAtDir.normalize(); + + return camInfo; } virtual void stopStep()