godot-steering-ai-framework/project/src/Behaviors/GSTFlee.gd

16 lines
456 B
GDScript3
Raw Normal View History

class_name GSTFlee
2020-01-16 23:14:50 +01:00
extends GSTSeek
# Calculates acceleration to take an agent directly away from a target agent.
func _init(agent: GSTSteeringAgent, target: GSTAgentLocation).(agent, target) -> void:
pass
func _calculate_steering(acceleration: GSTTargetAcceleration) -> GSTTargetAcceleration:
acceleration.linear = (
(agent.position - target.position).normalized() * agent.linear_acceleration_max)
acceleration.angular = 0
return acceleration