BVB Source Codes

CRYENGINE Show VehicleHelper.cpp Source code

Return Download CRYENGINE: download VehicleHelper.cpp Source code - Download CRYENGINE Source code - Type:.cpp
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. /*************************************************************************
  4.    -------------------------------------------------------------------------
  5.    $Id$
  6.    $DateTime$
  7.    Description:
  8.  
  9.    -------------------------------------------------------------------------
  10.    History:
  11.    - 03:04:2006: Created by Mathieu Pinard
  12.  
  13. *************************************************************************/
  14. #include "StdAfx.h"
  15. #include "IVehicleSystem.h"
  16. #include "VehicleHelper.h"
  17. #include "CryAction.h"
  18. #include "PersistantDebug.h"
  19.  
  20. //------------------------------------------------------------------------
  21. void CVehicleHelper::GetVehicleTM(Matrix34& vehicleTM, bool forced) const
  22. {
  23.         vehicleTM = m_localTM;
  24.  
  25.         IVehiclePart* pParent = m_pParentPart;
  26.         while (pParent)
  27.         {
  28.                 vehicleTM = pParent->GetLocalTM(true, forced) * vehicleTM;
  29.                 pParent = pParent->GetParent();
  30.         }
  31. }
  32.  
  33. //------------------------------------------------------------------------
  34. void CVehicleHelper::GetWorldTM(Matrix34& worldTM) const
  35. {
  36.         FUNCTION_PROFILER(gEnv->pSystem, PROFILE_ACTION);
  37.  
  38.         const Matrix34& partWorldTM = m_pParentPart->GetWorldTM();
  39.  
  40.         worldTM = Matrix34(Matrix33(partWorldTM) * Matrix33(m_localTM));
  41.         worldTM.SetTranslation((partWorldTM * m_localTM).GetTranslation());
  42. }
  43.  
  44. //------------------------------------------------------------------------
  45. void CVehicleHelper::GetReflectedWorldTM(Matrix34& reflectedWorldTM) const
  46. {
  47.         FUNCTION_PROFILER(gEnv->pSystem, PROFILE_ACTION);
  48.  
  49.         Matrix34 tempMatrix = m_localTM;
  50.         tempMatrix.m03 = -tempMatrix.m03; // negate x coord of translation
  51.  
  52.         const Matrix34& partWorldTM = m_pParentPart->GetWorldTM();
  53.  
  54.         reflectedWorldTM = Matrix34(Matrix33(partWorldTM) * Matrix33(tempMatrix));
  55.         reflectedWorldTM.SetTranslation((partWorldTM * tempMatrix).GetTranslation());
  56. }
  57.  
  58. //------------------------------------------------------------------------
  59. Vec3 CVehicleHelper::GetLocalSpaceTranslation() const
  60. {
  61.         return m_localTM.GetTranslation();
  62. }
  63.  
  64. //------------------------------------------------------------------------
  65. Vec3 CVehicleHelper::GetVehicleSpaceTranslation() const
  66. {
  67.         Matrix34 temp;
  68.         GetVehicleTM(temp);
  69.         return temp.GetTranslation();
  70. }
  71.  
  72. //------------------------------------------------------------------------
  73. Vec3 CVehicleHelper::GetWorldSpaceTranslation() const
  74. {
  75.         Matrix34 temp;
  76.         GetWorldTM(temp);
  77.         return temp.GetTranslation();
  78. }
  79.  
  80. //------------------------------------------------------------------------
  81. IVehiclePart* CVehicleHelper::GetParentPart() const
  82. {
  83.         return m_pParentPart;
  84. }
  85.  
downloadVehicleHelper.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