Skip to content

PhysicsMovement ​

Inherits: ProjectileMovement < RefCounted

Physics-based movement strategy - ballistic trajectories with gravity Only works with PhysicalProjectileInstance that has RigidBody3D

Variables ​

Vector3target_position
boolinitial_velocity_appliedfalse
Vector3initial_velocityVector3.ZERO
booluse_high_arcfalse
floatlaunch_angle_override0.0

Methods ​

voidset_use_high_arc( high_arc: bool )
voidset_launch_angle_override( angle_degrees: float )
floatget_launch_angle_degrees()
Vector3get_current_velocity()
floatget_current_actual_speed()
Vector3get_initial_velocity()
Dictionaryget_trajectory_info()
boolis_trajectory_valid()
floatget_distance_to_target()
Vector3get_current_direction()
boolwants_to_continue()
voidcleanup()

Variable descriptions ​

Vector3 target_position ​

Target position captured at launch (for ballistic calculation)

bool initial_velocity_applied = false ​

Whether the initial velocity has been applied

Vector3 initial_velocity = Vector3.ZERO ​

Initial velocity vector calculated for ballistic trajectory

bool use_high_arc = false ​

Whether to use high or low arc trajectory

float launch_angle_override = 0.0 ​

Launch angle override (if > 0, uses this instead of calculated angle)

Method descriptions ​

void set_use_high_arc( high_arc: bool ) ​

Set whether to use high arc trajectory

void set_launch_angle_override( angle_degrees: float ) ​

Set launch angle override (in degrees, 0 = auto-calculate)

float get_launch_angle_degrees() ​

Get calculated launch angle (in degrees)

Vector3 get_current_velocity() ​

Get current velocity from RigidBody3D

float get_current_actual_speed() ​

Get current speed from physics body

Vector3 get_initial_velocity() ​

Get initial velocity that was applied

Dictionary get_trajectory_info() ​

Get trajectory info for debugging

bool is_trajectory_valid() ​

Check if trajectory calculation was successful

float get_distance_to_target() ​

Override distance calculation to use captured target position

Vector3 get_current_direction() ​

Override current direction to use current velocity

bool wants_to_continue() ​

Physics movement doesn't need to continue after triggers

void cleanup() ​

Override cleanup to reset physics state