InteractWithObjectTask ​
Inherits: BehaviorTask < Resource
Make entity interact with a specific interactable object by unique ID Enhanced with proper signal-based movement handling
Properties ​
int | target_interactable_id | 0 |
bool | move_to_object | true |
bool | force_walking | false |
float | max_interaction_distance | 2.0 |
bool | face_object | true |
float | wait_time | 0.0 |
Variables ​
InteractableObject | target_interactable | null |
Vector3 | object_position | Vector3.ZERO |
float | interaction_range | 2.0 |
bool | movement_completed | false |
bool | facing_completed | false |
bool | object_interaction_completed | false |
Timer | wait_timer | null |
bool | waiting_after_interaction | false |
Methods ​
void | execute_task_start() |
void | execute_task_complete() |
void | execute_task_interrupt() |
void | execute_task_fail() |
InteractableObject | get_target_interactable() |
float | get_distance_to_target() |
bool | is_in_interaction_range() |
void | set_target_interactable_id( new_id: int ) |
bool | is_target_accessible() |
void | set_max_interaction_distance( distance: float ) |
void | cleanup_timers() |
Property descriptions ​
Target
int target_interactable_id = 0 ​
The unique ID of the interactable to interact with
bool move_to_object = true ​
Whether to move to the object before interacting
bool force_walking = false ​
Whether to force walking instead of running
float max_interaction_distance = 2.0 ​
Maximum distance to attempt interaction from
bool face_object = true ​
Whether to face the object before interacting
Post-Interaction
float wait_time = 0.0 ​
Time to wait after interaction before completing (0 = complete immediately)
Variable descriptions ​
InteractableObject target_interactable = null ​
The object the entity interacts with.
Vector3 object_position = Vector3.ZERO ​
The position of the object.
float interaction_range = 2.0 ​
How close the entity must be to use the object.
bool movement_completed = false ​
True once the entity arrived.
bool facing_completed = false ​
True once the entity faces the object.
bool object_interaction_completed = false ​
True once the interaction is done.
Timer wait_timer = null ​
Timer for waiting after interaction
bool waiting_after_interaction = false ​
Whether we're currently waiting after interaction
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.
InteractableObject get_target_interactable() ​
The object the entity interacts with.
float get_distance_to_target() ​
The distance to the object (-1 when there is none).
bool is_in_interaction_range() ​
Is the entity close enough to use the object?
void set_target_interactable_id( new_id: int ) ​
Set the target interactable ID dynamically
bool is_target_accessible() ​
Check if target is currently accessible
void set_max_interaction_distance( distance: float ) ​
Set interaction distance dynamically
void cleanup_timers() ​
Frees the timers of the task.