godot-steering-ai-framework/project/src/Behaviors/GSTFlee.gd
Nathan Lovato 6276fc0413 Update code reference
Proof and edit docstrings in all the base types and proximity types
Remove docstring for the _init builtin callback
2020-01-27 17:31:10 -06:00

16 lines
456 B
GDScript

class_name GSTFlee
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