Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/components/CCmpUnitMotion.cpp
Show First 20 Lines • Show All 1,641 Lines • ▼ Show 20 Lines | if (ShouldTreatTargetAsCircle(maxRange, circleRadius)) | ||||
entity_pos_t circleDistance = (pos - CFixedVector2D(obstruction.x, obstruction.z)).Length() - circleRadius; | entity_pos_t circleDistance = (pos - CFixedVector2D(obstruction.x, obstruction.z)).Length() - circleRadius; | ||||
entity_pos_t previousCircleDistance = (pos - CFixedVector2D(previousObstruction.x, previousObstruction.z)).Length() - circleRadius; | entity_pos_t previousCircleDistance = (pos - CFixedVector2D(previousObstruction.x, previousObstruction.z)).Length() - circleRadius; | ||||
if (circleDistance < maxRange || previousCircleDistance < maxRange) | if (circleDistance < maxRange || previousCircleDistance < maxRange) | ||||
{ | { | ||||
// We're already in range - no need to move anywhere | // We're already in range - no need to move anywhere | ||||
if (m_FacePointAfterMove) | if (m_FacePointAfterMove) | ||||
FaceTowardsPointFromPos(pos, goal.x, goal.z); | FaceTowardsPointFromPos(pos, goal.x, goal.z); | ||||
return false; | return true; | ||||
} | } | ||||
entity_pos_t goalDistance = maxRange - Pathfinding::GOAL_DELTA; | entity_pos_t goalDistance = maxRange - Pathfinding::GOAL_DELTA; | ||||
goal.type = PathGoal::CIRCLE; | goal.type = PathGoal::CIRCLE; | ||||
goal.hw = circleRadius + goalDistance; | goal.hw = circleRadius + goalDistance; | ||||
} | } | ||||
else | else | ||||
▲ Show 20 Lines • Show All 169 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator