2020-01-29 05:56:10 +01:00
|
|
|
# Calculates acceleration to take an agent directly away from a target agent.
|
2019-12-19 20:04:08 +01:00
|
|
|
class_name GSTFlee
|
2020-01-16 23:14:50 +01:00
|
|
|
extends GSTSeek
|
2019-12-19 20:04:08 +01:00
|
|
|
|
|
|
|
|
|
|
|
func _init(agent: GSTSteeringAgent, target: GSTAgentLocation).(agent, target) -> void:
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2020-02-06 20:46:21 +01:00
|
|
|
func _calculate_steering(acceleration: GSTTargetAcceleration) -> void:
|
2019-12-19 20:04:08 +01:00
|
|
|
acceleration.linear = (
|
2020-01-22 17:55:49 +01:00
|
|
|
(agent.position - target.position).normalized() * agent.linear_acceleration_max)
|
2019-12-19 20:04:08 +01:00
|
|
|
acceleration.angular = 0
|