mirror of
https://github.com/Relintai/godot-steering-ai-framework.git
synced 2024-11-14 04:57:19 +01:00
14 lines
466 B
GDScript
14 lines
466 B
GDScript
# Calculates an acceleration to take an agent to a target agent's position
|
|
# directly.
|
|
# @category - Individual behaviors
|
|
class_name GSAISeek
|
|
extends GSAISteeringBehavior
|
|
|
|
# The target that the behavior aims to move the agent to.
|
|
var target : GSAIAgentLocation
|
|
|
|
|
|
func _calculate_steering(acceleration: GSAITargetAcceleration) -> void:
|
|
acceleration.linear = ((target.position - agent.position).normalized() * agent.linear_acceleration_max)
|
|
acceleration.angular = 0
|