mirror of
				https://github.com/DarkflameUniverse/DarkflameServer.git
				synced 2025-10-31 20:52:01 +00:00 
			
		
		
		
	fix: reverse bounce paths (#1798)
This commit is contained in:
		| @@ -54,6 +54,7 @@ MovementAIComponent::MovementAIComponent(Entity* parent, MovementAIInfo info) : | ||||
| 	m_SourcePosition = m_Parent->GetPosition(); | ||||
| 	m_Paused = false; | ||||
| 	m_SavedVelocity = NiPoint3Constant::ZERO; | ||||
| 	m_IsBounced = false; | ||||
|  | ||||
| 	if (!m_Parent->GetComponent<BaseCombatAIComponent>()) SetPath(m_Parent->GetVarAsString(u"attached_path")); | ||||
| } | ||||
| @@ -158,8 +159,9 @@ void MovementAIComponent::Update(const float deltaTime) { | ||||
| 				if (m_Path->pathBehavior == PathBehavior::Loop) { | ||||
| 					SetPath(m_Path->pathWaypoints); | ||||
| 				} else if (m_Path->pathBehavior == PathBehavior::Bounce) { | ||||
| 					m_IsBounced = !m_IsBounced; | ||||
| 					std::vector<PathWaypoint> waypoints = m_Path->pathWaypoints; | ||||
| 					std::reverse(waypoints.begin(), waypoints.end()); | ||||
| 					if (m_IsBounced) std::reverse(waypoints.begin(), waypoints.end()); | ||||
| 					SetPath(waypoints); | ||||
| 				} else if (m_Path->pathBehavior == PathBehavior::Once) { | ||||
| 					Stop(); | ||||
|   | ||||
| @@ -321,6 +321,8 @@ private: | ||||
| 	bool m_Paused; | ||||
|  | ||||
| 	NiPoint3 m_SavedVelocity; | ||||
|  | ||||
| 	bool m_IsBounced{}; | ||||
| }; | ||||
|  | ||||
| #endif // MOVEMENTAICOMPONENT_H | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 David Markowitz
					David Markowitz