2020-01-29 05:56:10 +01:00
|
|
|
# Calculates acceleration to take an agent directly away from a target agent.
|
2020-02-22 18:48:58 +01:00
|
|
|
# category: Individual behaviors
|
2020-02-11 18:33:25 +01:00
|
|
|
class_name GSAIFlee
|
|
|
|
extends GSAISeek
|
2019-12-19 20:04:08 +01:00
|
|
|
|
|
|
|
|
2020-02-11 18:33:25 +01:00
|
|
|
func _init(agent: GSAISteeringAgent, target: GSAIAgentLocation).(agent, target) -> void:
|
2019-12-19 20:04:08 +01:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
2020-02-11 18:33:25 +01:00
|
|
|
func _calculate_steering(acceleration: GSAITargetAcceleration) -> void:
|
2019-12-19 20:04:08 +01:00
|
|
|
acceleration.linear = (
|
2020-02-14 17:35:18 +01:00
|
|
|
(agent.position - target.position).normalized()
|
|
|
|
* agent.linear_acceleration_max
|
|
|
|
)
|
2019-12-19 20:04:08 +01:00
|
|
|
acceleration.angular = 0
|