2020-01-29 05:56:10 +01:00
|
|
|
# Calculates acceleration to take an agent directly away from a target agent.
|
2020-04-03 02:31:59 +02: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:
|
2023-01-13 13:09:18 +01:00
|
|
|
acceleration.linear = ((agent.position - target.position).normalized() * agent.linear_acceleration_max)
|
2019-12-19 20:04:08 +01:00
|
|
|
acceleration.angular = 0
|