Skip to content

CurvedHomingMovement ​

Inherits: HomingMovement < ProjectileMovement < RefCounted

Homing movement with curve patterns and rotation control Adds oscillation, spiraling, or wave patterns while still tracking target

Variables ​

HomingCurveTypecurve_typeHomingCurveType.STRAIGHT
floatcurve_strength0.3
floatoscillation_frequency2.0
floatoscillation_amplitude1.0
floatcurve_time0.0
CurveRotationModecurve_rotation_modeCurveRotationMode.UP
floatfixed_curve_rotation0.0
floatrandom_rotation_range90.0
floatcurve_rotation0.0
booluse_left_curvefalse

Methods ​

voidset_curve_type( type: int )
voidset_curve_strength( strength: float )
voidset_oscillation_parameters( frequency: float, amplitude: float )
voidset_curve_rotation_mode( mode: CurveRotationMode )
voidset_fixed_curve_rotation( rotation_degrees: float )
voidset_random_rotation_range( range_degrees: float )
boolwants_to_continue()
voidcleanup()

Enumerations ​

enum HomingCurveType ​

The options of homing curve type: straight, oscillating, spiral, sine wave, drunken.

  • STRAIGHT = 0
  • OSCILLATING = 1
  • SPIRAL = 2
  • SINE_WAVE = 3

enum CurveRotationMode ​

The options of curve rotation mode: fixed, left, right, up, down, alternating, random full, random range.

  • FIXED = 0
  • LEFT = 1
  • RIGHT = 2
  • UP = 3
  • DOWN = 4
  • ALTERNATING = 5
  • RANDOM_FULL = 6

Variable descriptions ​

HomingCurveType curve_type = HomingCurveType.STRAIGHT ​

The shape of the curve added to the homing.

float curve_strength = 0.3 ​

How much curve affects movement (0.0 to 1.0)

float oscillation_frequency = 2.0 ​

Oscillation speed

float oscillation_amplitude = 1.0 ​

Oscillation strength

float curve_time = 0.0 ​

Time tracker for curve calculations

CurveRotationMode curve_rotation_mode = CurveRotationMode.UP ​

How the curve is rotated for each projectile.

float fixed_curve_rotation = 0.0 ​

Degrees from UP

float random_rotation_range = 90.0 ​

Degrees of random variation

float curve_rotation = 0.0 ​

Calculated rotation in radians

bool use_left_curve = false ​

Set externally for alternating mode

Method descriptions ​

void set_curve_type( type: int ) ​

Set curve type

void set_curve_strength( strength: float ) ​

Set curve strength (how much curve affects movement)

void set_oscillation_parameters( frequency: float, amplitude: float ) ​

Set oscillation parameters

void set_curve_rotation_mode( mode: CurveRotationMode ) ​

Set curve rotation mode

void set_fixed_curve_rotation( rotation_degrees: float ) ​

Set fixed curve rotation (in degrees)

void set_random_rotation_range( range_degrees: float ) ​

Set random rotation range (in degrees)

bool wants_to_continue() ​

Curved homing movement doesn't need to continue after triggers

void cleanup() ​

Resets the curve.