Skip to content

NonPhysicalProjectileInstance ​

Inherits: BaseProjectileInstance < Node3D

Lightweight projectile with raycast-only collision detection Movement is handled entirely by movement strategies, this class only provides collision detection

Variables ​

Vector3velocityVector3.ZERO
Vector3movement_directionVector3.FORWARD
Vector3previous_position
floatraycast_range5.0
booluse_raycast_collisiontrue

Methods ​

voidactivate_projectile()
voiddeactivate_projectile()
voidset_velocity( new_velocity: Vector3 )
Vector3get_velocity()
floatget_current_speed()
voidstop_projectile()
voidset_direction( new_direction: Vector3 )
voidaccelerate( acceleration: Vector3, delta: float )
voidapply_steering_force( force: Vector3, max_force: float = 10.0 )
floatget_distance_to_target()
boolis_near_target( threshold: float )
Vector3get_direction_to_target()
Vector3get_movement_direction()
voidreset_projectile()
Dictionaryget_projectile_debug_info()

Variable descriptions ​

Vector3 velocity = Vector3.ZERO ​

Current movement velocity (set by movement strategies)

Vector3 movement_direction = Vector3.FORWARD ​

Current movement direction (normalized, set by movement strategies)

Vector3 previous_position ​

Previous position for raycast collision detection

float raycast_range = 5.0 ​

Raycast range per frame for collision detection

bool use_raycast_collision = true ​

Always use raycast collision (no Area3D)

Method descriptions ​

void activate_projectile() ​

Override activate to setup raycast collision

void deactivate_projectile() ​

Override deactivate - no special cleanup needed

void set_velocity( new_velocity: Vector3 ) ​

Set velocity (called by movement strategies)

Vector3 get_velocity() ​

Get current velocity

float get_current_speed() ​

Get current speed

void stop_projectile() ​

Stop the projectile movement

void set_direction( new_direction: Vector3 ) ​

Change direction while maintaining speed

void accelerate( acceleration: Vector3, delta: float ) ​

Apply acceleration (for movement strategies that need it)

void apply_steering_force( force: Vector3, max_force: float = 10.0 ) ​

Apply steering force (for homing projectiles)

float get_distance_to_target() ​

Get distance to target (useful for movement strategies)

bool is_near_target( threshold: float ) ​

Check if within distance of target

Vector3 get_direction_to_target() ​

Get direction to target

Vector3 get_movement_direction() ​

Override movement direction getter

void reset_projectile() ​

Override reset for raycast-specific cleanup

Dictionary get_projectile_debug_info() ​

Get debug info specific to non-physical projectiles