Skip to content

HomingMovement ​

Inherits: ProjectileMovement < RefCounted

Inherited by: CurvedHomingMovement

Homing movement strategy - continuously tracks and follows target Updates direction each frame to chase moving targets

Variables ​

floathoming_strength1.0
floatmax_turn_ratePI * 2.0 # 360 degrees per second
floatarrival_threshold1.0
booluse_smooth_steeringtrue
floatmax_speed30.0
Vector3velocityVector3.ZERO

Methods ​

voidset_homing_strength( strength: float )
voidset_max_turn_rate_degrees( degrees_per_second: float )
voidset_arrival_threshold( threshold: float )
voidset_smooth_steering( enabled: bool )
voidset_max_speed( new_max_speed: float )
Vector3get_current_velocity()
floatget_current_actual_speed()
floatget_angle_to_target()
boolis_facing_target( tolerance_degrees: float = 10.0 )
boolwants_to_continue()
voidcleanup()

Variable descriptions ​

float homing_strength = 1.0 ​

How quickly the projectile can turn (0.0 to 1.0)

float max_turn_rate = PI * 2.0 # 360 degrees per second ​

Maximum turn rate per second (in radians)

float arrival_threshold = 1.0 ​

Distance threshold to consider target reached

bool use_smooth_steering = true ​

Whether to use smooth steering or instant direction changes

float max_speed = 30.0 ​

Maximum speed the projectile can reach

Vector3 velocity = Vector3.ZERO ​

Current velocity vector

Method descriptions ​

void set_homing_strength( strength: float ) ​

Set homing strength (0.0 = no homing, 1.0 = perfect homing)

void set_max_turn_rate_degrees( degrees_per_second: float ) ​

Set maximum turn rate in degrees per second

void set_arrival_threshold( threshold: float ) ​

Set arrival threshold

void set_smooth_steering( enabled: bool ) ​

Enable/disable smooth steering

void set_max_speed( new_max_speed: float ) ​

Set maximum speed

Vector3 get_current_velocity() ​

Get current velocity

float get_current_actual_speed() ​

Get current actual speed

float get_angle_to_target() ​

Get angle to target (in degrees)

bool is_facing_target( tolerance_degrees: float = 10.0 ) ​

Check if projectile is facing target (within tolerance)

bool wants_to_continue() ​

Homing movement doesn't need to continue after triggers

void cleanup() ​

Reset velocity on cleanup