godot-steering-ai-framework/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIFlee.gd

10 lines
355 B
GDScript

class_name GSAIFlee
extends GSAISeek
# Calculates acceleration to take an agent directly away from a target agent.
# @category - Individual behaviors
func _calculate_steering(acceleration: GSAITargetAcceleration) -> void:
acceleration.linear = ((agent.position - target.position).normalized() * agent.linear_acceleration_max)
acceleration.angular = 0