mirror of
https://github.com/Relintai/godot-steering-ai-framework.git
synced 2025-01-05 17:59:39 +01:00
26 lines
547 B
GDScript3
26 lines
547 B
GDScript3
|
class_name GSTSteeringBehavior
|
||
|
"""
|
||
|
Base class to calculate how an AI agent steers itself.
|
||
|
"""
|
||
|
|
||
|
|
||
|
var enabled: = true
|
||
|
var agent: GSTSteeringAgent
|
||
|
|
||
|
|
||
|
func _init(agent: GSTSteeringAgent) -> void:
|
||
|
self.agent = agent
|
||
|
|
||
|
|
||
|
func calculate_steering(acceleration: GSTTargetAcceleration) -> GSTTargetAcceleration:
|
||
|
if enabled:
|
||
|
return _calculate_steering(acceleration)
|
||
|
else:
|
||
|
acceleration.set_zero()
|
||
|
return acceleration
|
||
|
|
||
|
|
||
|
func _calculate_steering(acceleration: GSTTargetAcceleration) -> GSTTargetAcceleration:
|
||
|
acceleration.set_zero()
|
||
|
return acceleration
|