mirror of
https://github.com/Relintai/godot-steering-ai-framework.git
synced 2025-01-01 13:49:49 +01:00
1a37b2bee0
Used `var variable := 0.0` as discussed in the Godot issue, instead of `var variable: = 0.0`. Mostly these are minor/cosmetic changes, but I've also reorganized the folder structure (naming of folders) to reflect our guidelines, plus made some minor changes to the demo codes. Still work in progress.
16 lines
456 B
GDScript
16 lines
456 B
GDScript
extends GSTSeek
|
|
class_name GSTFlee
|
|
# 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.max_linear_acceleration)
|
|
acceleration.angular = 0
|
|
|
|
return acceleration
|