Skip to content

MoveToPointTask ​

Inherits: BehaviorTask < Resource

Complete MoveToPointTask with all Phase 1-3 enhancements. Features robust navigation integration, enhanced path failure handling, auto-updating progress, and comprehensive error recovery.

Properties ​

Vector3target_positionVector3.ZERO
floatmin_distance-1.0
boolforce_walkingtrue
floatposition_threshold0.1
intmax_pathfinding_attempts3
floatwait_time0.0
boolface_direction_on_arrivalfalse
Vector3arrival_face_directionVector3.ZERO
MovementStylemovement_styleMovementStyle.NORMAL
boolfail_on_path_failurefalse
booltry_alternative_positionstrue
floatalternative_search_radius3.0

Variables ​

intcurrent_pathfinding_attempt0
Timerwait_timernull
Vector3original_target_positionVector3.ZERO
boolwaiting_at_destinationfalse

Methods ​

voidexecute_task_start()
voidexecute_task_complete()
voidexecute_task_interrupt()
voidexecute_task_fail()
voidset_target_position( new_position: Vector3 )
floatget_distance_to_target()
boolis_movement_complete()
voidset_simplified_mode( enable: bool )
voidcleanup_timers()

Enumerations ​

enum MovementStyle ​

The options of movement style: normal, keep facing, backpedal.

  • NORMAL = 0 - Regular movement with turning
  • KEEP_FACING = 1 - Move without changing facing direction
  • BACKPEDAL = 2 - Move backwards while keeping current facing

Property descriptions ​

Movement

Vector3 target_position = Vector3.ZERO ​

Target position to move to

float min_distance = -1.0 ​

Minimum distance to maintain from target (-1 = use navigation default)

bool force_walking = true ​

Whether to walk instead of run

float position_threshold = 0.1 ​

Position threshold for considering destination reached

int max_pathfinding_attempts = 3 ​

Maximum attempts to find a path before giving up

Destination Behavior

float wait_time = 0.0 ​

Time to wait at destination before completing (0 = complete immediately)

bool face_direction_on_arrival = false ​

Whether to face a specific direction after reaching destination

Vector3 arrival_face_direction = Vector3.ZERO ​

Direction to face after arrival (if face_direction_on_arrival is true)

Movement Type

MovementStyle movement_style = MovementStyle.NORMAL ​

Type of movement to use

Error Handling

bool fail_on_path_failure = false ​

Whether to fail task if path cannot be found

bool try_alternative_positions = true ​

Whether to try alternative nearby positions if exact position fails

float alternative_search_radius = 3.0 ​

Distance to search for alternative positions

Variable descriptions ​

int current_pathfinding_attempt = 0 ​

Current pathfinding attempt

Timer wait_timer = null ​

Timer for waiting at destination

Vector3 original_target_position = Vector3.ZERO ​

Original target position (before any adjustments)

bool waiting_at_destination = false ​

Whether we're currently waiting at the destination

Method descriptions ​

void execute_task_start() ​

Starts the task.

void execute_task_complete() ​

Called when the task finishes well.

void execute_task_interrupt() ​

Called when something interrupts the task.

void execute_task_fail() ​

Called when the task fails.

void set_target_position( new_position: Vector3 ) ​

Sets the point the entity moves to.

float get_distance_to_target() ​

The distance to the point (-1 when there is no entity).

bool is_movement_complete() ​

Did the entity arrive (and wait there, if the task waits)?

void set_simplified_mode( enable: bool ) ​

Check if we can modify this task for simplified behavior (LOD system support)

void cleanup_timers() ​

Frees the timers of the task.