BVB Source Codes

CRYENGINE Show MovementBlock_UseExactPositioning.cpp Source code

Return Download CRYENGINE: download MovementBlock_UseExactPositioning.cpp Source code - Download CRYENGINE Source code - Type:.cpp
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. #include "StdAfx.h"
  4. #include "MovementBlock_UseExactPositioning.h"
  5. #include "MovementActor.h"
  6. #include <CryAISystem/MovementUpdateContext.h>
  7. #include "MovementHelpers.h"
  8. #include "Navigation/NavigationSystem/NavigationSystem.h"
  9. #include "PipeUser.h"
  10. #include "AIBubblesSystem/AIBubblesSystem.h"
  11.  
  12. namespace Movement
  13. {
  14. namespace MovementBlocks
  15. {
  16. UseExactPositioning::UseExactPositioning(
  17.   const CNavPath& path,
  18.   const MovementStyle& style)
  19.         : Base(path, style)
  20. {
  21.  
  22. }
  23.  
  24. UseExactPositioningBase::TryRequestingExactPositioningResult UseExactPositioning::TryRequestingExactPositioning(const MovementUpdateContext& context)
  25. {
  26.         CRY_ASSERT(m_style.GetExactPositioningRequest());
  27.         if (m_style.GetExactPositioningRequest() == 0)
  28.         {
  29.                 return RequestFailed_FinishImmediately;
  30.         }
  31.  
  32.         const bool useLowerPrecision = false;
  33.         context.actor.GetAdapter().RequestExactPosition(m_style.GetExactPositioningRequest(), useLowerPrecision);
  34.  
  35.         return RequestSucceeded;
  36. }
  37.  
  38. void UseExactPositioning::HandleExactPositioningError(const MovementUpdateContext& context)
  39. {
  40.         const EntityId actorEntityId = context.actor.GetEntityId();
  41.         if (IEntity* entity = gEnv->pEntitySystem->GetEntity(actorEntityId))
  42.         {
  43.                 // Consider teleporting to the startpoint here, with code like the following
  44.                 // (needs to be discussed further)
  45.                 //
  46.                 //if (m_style.GetExactPositioningRequest() != 0)
  47.                 //{
  48.                 //Vec3 newForwardDir = m_style.GetExactPositioningRequest()->animDirection.GetNormalizedSafe(FORWARD_DIRECTION);
  49.  
  50.                 //QuatT teleportDestination(
  51.                 //      m_style.GetExactPositioningRequest()->animLocation,
  52.                 //      Quat::CreateRotationV0V1(FORWARD_DIRECTION, newForwardDir));
  53.  
  54.                 //entity->SetWorldTM(Matrix34(teleportDestination));
  55.                 //}
  56.  
  57.                 // Report
  58.                 stack_string message;
  59.                 message.Format("Exact positioning failed to get me to the start of the actor target or was canceled incorrectly.");
  60.                 AIQueueBubbleMessage("PrepareForExactPositioningError", actorEntityId, message.c_str(), eBNS_Balloon | eBNS_LogWarning);
  61.         }
  62. }
  63. }
  64. }
  65.  
downloadMovementBlock_UseExactPositioning.cpp Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top