mirror of
https://github.com/Relintai/godot-steering-ai-framework.git
synced 2024-11-10 00:52:10 +01:00
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:
parent
fe00d231b8
commit
0eb4adc48c
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user