7 #include "VectorMathDecl.h"
8 #include "Navigation.h"
21 static const float DEATH_FADE_OUT_SECONDS = .5f;
23 static const float CLOSE_ENOUGH_TO_TARGET_DISTANCE = 4.0;
24 static const float CLOSE_ENOUGH_DISTANCE_SQR = CLOSE_ENOUGH_TO_TARGET_DISTANCE * CLOSE_ENOUGH_TO_TARGET_DISTANCE;
25 static const float CENTER_OF_LANE_OFFSET = 0.45f;
26 static const float TURNING_ANGLE = 1.0f;
27 static const float CAR_BOUNDS_RADIUS = 10.f;
28 static const float CAR_COLLISION_RADIUS = 8.f;
29 static const float HeightCheckInterval = 1.5f;
35 const std::string& modelName,
36 const std::string& modelNamesuffix,
37 const int beginningRoadIndex,
38 const bool drivesOnRight,
44 float closeEnoughDistSq=CLOSE_ENOUGH_DISTANCE_SQR,
45 float centerOfLaneOffset=CENTER_OF_LANE_OFFSET,
46 float turningAngle=TURNING_ANGLE);
50 const Eegeo::dv3& GetWorldPosition()
const {
return m_worldPosition; }
51 const Eegeo::v3& GetForwardsVector()
const {
return m_forwards; }
52 const std::string& GetFullModelNodeName()
const {
return m_fullModelNodeName; }
54 bool GetInitialised() {
return m_initialised; }
55 void ClearNextCell() { m_nextCellToTravelTo = NULL; }
56 void Update(
float elapsedSeconds,
float speedMultiplier,
const dv3& ecefInterestPoint);
57 void Initialise(
const dv3& ecefInterestPoint);
59 void UpdateVelocity(
float velocity) { m_velocity = velocity; }
60 float GetDistanceToEndOfCurrentPath();
61 bool IsOnFinalRoadInPath(
float& out_distanceToEnd);
62 bool GetVehicleOnDeadEnd();
63 float Alpha() {
return std::max(1.0f - m_deathCeremonyTimePassedSeconds/DEATH_FADE_OUT_SECONDS, 0.f); }
64 bool VehicleMarkedToRemove() {
return m_deathCeremonyTimePassedSeconds >= DEATH_FADE_OUT_SECONDS; }
66 float GetBoundsRadius()
const;
67 float GetScale()
const;
69 void FadeOutThenDestroyVehicle();
70 bool IsPlayingDeathCeremony() {
return m_playingDeathCeremony; }
72 float GetCollisionRadius()
const;
74 bool CanCollide()
const;
76 void SetModelNodeNameSuffix(
const std::string &suffix);
78 bool IsUnderground()
const;
79 void SetIsUnderground(
bool isUnderground);
80 bool NeedsUndergroundCheck();
85 const float m_closeEnoughDistSq;
86 const float m_centerOfLaneOffset;
87 const float m_turningAngle;
88 bool m_expectPathToEndInDeadEnd;
90 float m_deathCeremonyTimePassedSeconds;
91 bool m_dieAtEndOfPath;
92 bool m_playingDeathCeremony;
97 bool m_directionIsForwards;
104 std::vector<TrafficPathNode> m_pathNodes;
105 const std::string& m_modelName;
106 std::string m_fullModelNodeName;
107 bool m_drivesOnRight;
112 int m_currentPathNodeIndex;
113 int m_finalRoadIndex;
114 int m_finalVertIndex;
116 float m_heightCheckTimer;
117 bool m_isUnderground;
119 std::vector<int> m_debugUsedRoadIndices;
121 std::vector<Resources::Roads::Navigation::NavigationGraphRoad*> m_recentMemory;
122 size_t m_recentMemoryRingLatest;
124 void CreateNewPath(
const int initialRoadIndex,
const dv3& ecefInterestPoint);
125 void ResetToStartOfPath();
129 bool ¤tDirectionIsForwards);
133 bool ¤tDirectionIsForwards,
135 std::vector<int> &usedRoadIndices,
137 const dv3& ecefInterestPoint);