Fix bug for collision avoid direction reversed

Once the agent was close enough to a neighbor, it tried to get closer
instead of away.
This commit is contained in:
Francois Belair 2020-01-21 12:49:46 -05:00
parent fe00d231b8
commit 0eb4adc48c

View File

@ -32,8 +32,9 @@ func _calculate_steering(acceleration: GSTTargetAcceleration) -> GSTTargetAccele
acceleration.linear = first_neighbor.position - agent.position
else:
acceleration.linear = first_relative_position + (first_relative_velocity * shortest_time)
acceleration.linear = acceleration.linear.normalized() * -agent.max_linear_acceleration
acceleration.angular = 0
acceleration.linear = acceleration.linear.normalized() * -agent.max_linear_acceleration
acceleration.angular = 0
return acceleration