Skip to content

$touch_box

12 natives. Read-only natives only look things up; the rest change something. Parameter types use the language's names (Types).

add_axis

$touch_box.add_axis(axis_type: int, keymap: Reference, x_alias: string, y_alias: string) -> list

Add axis features to the entity's touch box.

ParameterTypeMeaning
axis_typeintThe type of gesture the box should respond to.
keymapReferenceThe keymap used to trigger the related alias.
x_aliasstringInput alias for the x-axis to trigger.
y_aliasstringInput alias for the y-axis to trigger.

Returns list: Returns the axis handles (x, y) used by the touch box.

add_gesture

$touch_box.add_gesture(gesture_type: int, keymap: Reference, alias: string) -> int

Add gesture detection to the entity's touch box.

ParameterTypeMeaning
gesture_typeintThe type of gesture the box should respond to.
keymapReferenceThe keymap used to trigger the related alias.
aliasstringInput alias for this box to trigger.

Returns int: Returns the gesture handle used by the touch box.

create

$touch_box.create(bounds_min: vec2, bounds_max: vec2) -> bool

Creates a touch box instance from cache.

ParameterTypeMeaning
bounds_minvec2Minimum bounds for the box.
bounds_maxvec2Maximum bounds for the box.

Returns bool: Returns if the box was created successfully.

get_axis_data

$touch_box.get_axis_data() -> list

Gets axis data from a touch box.

Returns list: Returns a list containing joystick axis data.

get_hold_time

$touch_box.get_hold_time() -> float

Gets the amount of time the box has been held down.

Returns float: Returns time (in seconds) the box has been held down.

get_input_delta

$touch_box.get_input_delta() -> vec2

Gets last input delta from a touch box.

Returns vec2: Returns the last updated input delta.

get_pressure

$touch_box.get_pressure() -> float

Gets touch pressure.

Returns float: Returns touch pressure in a range of 0-10.

get_was_tapped

$touch_box.get_was_tapped(gesture_handle: int) -> int

Gets the number of total taps if the box was tapped this frame.

ParameterTypeMeaning
gesture_handleintHandle to the gesture data.

Returns int: Returns > 0 if tapped otherwise 0.

reset

$touch_box.reset(gesture_handle: int)

Resets gesture data for a given touch box allowing them to be retriggered.

ParameterTypeMeaning
gesture_handleintGesture data to reset.

set_axis_active_bounds

$touch_box.set_axis_active_bounds(active_bounds: vec4)

Set normalize bounds this axis should be active in.

ParameterTypeMeaning
active_boundsvec4The normalize screen bounds.

set_threshold

$touch_box.set_threshold(gesture_handle: int, threshold: float)

Set threshold using a gesture handle.

ParameterTypeMeaning
gesture_handleintHandle to the gesture data.
thresholdfloatThe threshold value to use for the gesture type.

set_threshold_range

$touch_box.set_threshold_range(gesture_handle: int, min_threshold: float, max_threshold: float)

Set range of thresholds using a gesture handle.

ParameterTypeMeaning
gesture_handleintHandle to the gesture data.
min_thresholdfloatThe min threshold value to use for the gesture type.
max_thresholdfloatThe max threshold value to use for the gesture type.