Skip to content

BoomerangMovement ​

Inherits: ProjectileMovement < RefCounted

Boomerang movement strategy - travels to target, then returns to originator Has two phases: outbound and return with optional curve intensity

Variables ​

BoomerangPhasecurrent_phaseBoomerangPhase.OUTBOUND
Entityoriginator
Vector3outbound_target_position
floattarget_arrival_threshold1.0
floatoriginator_arrival_threshold0.5
booltrack_moving_targettrue
floatreturn_speed_multiplier1.2
floatcurve_intensity0.3
Vector3curve_biasVector3.ZERO

Methods ​

voidset_target_arrival_threshold( threshold: float )
voidset_originator_arrival_threshold( threshold: float )
voidset_track_moving_target( enabled: bool )
voidset_return_speed_multiplier( multiplier: float )
voidset_curve_intensity( intensity: float )
voidset_curve_bias( bias: Vector3 )
voidforce_return_phase()
boolwants_to_continue()
BoomerangPhaseget_current_phase()
boolis_outbound()
boolis_returning()
floatget_distance_to_current_target()
floatget_current_effective_speed()
boolis_originator_valid()
floatget_distance_to_target()
voidcleanup()

Enumerations ​

enum BoomerangPhase ​

Current movement phase

  • OUTBOUND = 0
  • RETURNING = 1
  • FINISHED = 2

Variable descriptions ​

BoomerangPhase current_phase = BoomerangPhase.OUTBOUND ​

Which way the projectile goes now: out or back.

Entity originator ​

Reference to originator for return journey

Vector3 outbound_target_position ​

Target position for outbound phase (captured at start)

float target_arrival_threshold = 1.0 ​

Distance thresholds

float originator_arrival_threshold = 0.5 ​

How close to the originator the projectile must be to count as back.

bool track_moving_target = true ​

Whether to track moving entities during outbound phase

float return_speed_multiplier = 1.2 ​

Return speed multiplier (can be different from outbound speed)

float curve_intensity = 0.3 ​

Curve intensity (0.0 = straight, 1.0 = pronounced curve)

Vector3 curve_bias = Vector3.ZERO ​

Curve direction bias for consistent arcing

Method descriptions ​

void set_target_arrival_threshold( threshold: float ) ​

Set target arrival threshold

void set_originator_arrival_threshold( threshold: float ) ​

Set originator arrival threshold

void set_track_moving_target( enabled: bool ) ​

Enable/disable target tracking during outbound phase

void set_return_speed_multiplier( multiplier: float ) ​

Set return speed multiplier

void set_curve_intensity( intensity: float ) ​

Set curve intensity

void set_curve_bias( bias: Vector3 ) ​

Set curve bias direction

void force_return_phase() ​

Force transition to return phase (useful for triggered returns)

bool wants_to_continue() ​

Check if boomerang movement wants to continue

BoomerangPhase get_current_phase() ​

Get current phase

bool is_outbound() ​

Check if in outbound phase

bool is_returning() ​

Check if returning

float get_distance_to_current_target() ​

Get distance to current target (target during outbound, originator during return)

float get_current_effective_speed() ​

Get current effective speed

bool is_originator_valid() ​

Check if originator is still valid

float get_distance_to_target() ​

Override distance calculation based on current phase

void cleanup() ​

Override cleanup to reset phase