From 3e6ffa8b43899b772d76442ef24e08d49985343b Mon Sep 17 00:00:00 2001 From: Fabien_HENON Date: Thu, 9 Aug 2012 19:11:57 +0200 Subject: [PATCH] Added: #1469 Implementation of the Shake modifier --HG-- branch : gsoc2012-fabien --- .../camera_animation_modifiers_players.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/code/ryzom/client/src/camera_animation_manager/camera_animation_modifiers_players.cpp b/code/ryzom/client/src/camera_animation_manager/camera_animation_modifiers_players.cpp index 886278725..2ebdd5334 100644 --- a/code/ryzom/client/src/camera_animation_manager/camera_animation_modifiers_players.cpp +++ b/code/ryzom/client/src/camera_animation_manager/camera_animation_modifiers_players.cpp @@ -21,6 +21,8 @@ #include "camera_animation_manager/position_or_entity_pos_resolver.h" #include "global.h" #include "sound_manager.h" +#include "nel/misc/random.h" +#include "nel/misc/time_nl.h" ///////////////////////////////////////////////////////////////////////////// /// This animation modifier shakes the camera. The parameter is @@ -47,7 +49,21 @@ public: /// Function that plays the modifier virtual TCameraAnimationOutputInfo updateModifier(const TCameraAnimationInputInfo& currCamInfo) { - return currCamInfo.toOutput(); + TCameraAnimationOutputInfo output; + + NLMISC::CRandom rnd; + rnd.srand((sint32)NLMISC::CTime::getLocalTime()); + + NLMISC::CVector dirs((float)rnd.randPlusMinus(1), (float)rnd.randPlusMinus(1), (float)rnd.randPlusMinus(1)); + dirs.normalize(); + + // We increase the vector by the strength + dirs = dirs * Strength; + + output.CamLookAtDir = currCamInfo.CamLookAtDir; + output.CamPos = currCamInfo.CamPos + dirs; + + return output; } virtual void stopModifier()