diff --git a/code/ryzom/client/src/interface_v3/action_handler_move.cpp b/code/ryzom/client/src/interface_v3/action_handler_move.cpp index 5f02678aa..b33f71da5 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_move.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_move.cpp @@ -225,6 +225,17 @@ class CAHToggleCamera : public IActionHandler }; REGISTER_ACTION_HANDLER (CAHToggleCamera, "toggle_camera"); +// ------------------------------------------------------------------------------------------------ +class CAHToggleForceFP : public IActionHandler +{ + virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) + { + // Change the camera view to first person + UserEntity->forceCamareaFirstPerson(); + } +}; +REGISTER_ACTION_HANDLER (CAHToggleForceFP, "force_camera_fp"); + // ------------------------------------------------------------------------------------------------ class CAHToggleNames : public IActionHandler { @@ -446,4 +457,3 @@ class CAHToggleDodgeParry : public IActionHandler } }; REGISTER_ACTION_HANDLER (CAHToggleDodgeParry, "toggle_dodge_parry"); - diff --git a/code/ryzom/client/src/main_loop_debug.cpp b/code/ryzom/client/src/main_loop_debug.cpp index 5d2dcf9ac..7eb2989b4 100644 --- a/code/ryzom/client/src/main_loop_debug.cpp +++ b/code/ryzom/client/src/main_loop_debug.cpp @@ -748,6 +748,7 @@ void displayHelp() // DISP_TEXT(0.0f, "SHIFT + F11 : Test"); DISP_TEXT(0.0f, getActionKey("enter_modal", "group=ui:interface:quit_dialog") + " : Quit"); DISP_TEXT(0.0f, getActionKey("toggle_camera") + " : First/Third Person View"); + DISP_TEXT(0.0f, getActionKey("force_camera_fp") + " : Force Camera to First Person View"); line = 1.f; TextContext->setHotSpot(UTextContext::TopRight); diff --git a/code/ryzom/client/src/user_entity.cpp b/code/ryzom/client/src/user_entity.cpp index 3fd761262..5fd8c7dfb 100644 --- a/code/ryzom/client/src/user_entity.cpp +++ b/code/ryzom/client/src/user_entity.cpp @@ -3213,6 +3213,23 @@ void CUserEntity::toggleCamera() } }// toggleCamera // +//----------------------------------------------- +// forceCamareaFirstPerson : +// Force Camera to First Person View +//----------------------------------------------- +void CUserEntity::forceCamareaFirstPerson() +{ + // You cannot change the camera view when dead. + if(isDead()) + return; + // Only if not inside a building. + if(!UserEntity->forceIndoorFPV()) + { + //Enter the 1st Person View Mode + UserEntity->viewMode(CUserEntity::FirstPV); + } +}// forceCamareaFirstPerson // + //--------------------------------------------------- // getScale : // Return the entity scale. (return 1.0 if there is any problem).