Skip to Content
defold-typescript libraries
indiesoftby

indiesoftby/defold-hyper-trails/hyper_trails

Easy to use and customizable trail effect.

  • GitHub: indiesoftby/defold-hyper-trails — pinned to 1.4.2
    1. Pick a release from indiesoftby/defold-hyper-trails releases and add its Source code (zip) URL (or a packaged .zip asset, if the library ships one) to game.project under [project] dependencies, then Fetch Libraries in the Defold editor.
    2. Run bunx @defold-typescript/cli resolve to materialize its types.
    3. Import it under a namespace alias of your choice:
      import * as hyper_trails from "hyper_trails"

Functions

queue_late_update()

draw_trail(self: LuaMap<string, unknown> | PlainTable)

Draw the trail by encoding data to buffers and updating UV options

Parameters

  • self: LuaMap<string, unknown> | PlainTable — Script instance

encode_data_to_buffers(self: LuaMap<string, unknown> | PlainTable)

Encode trail data into mesh buffers

Parameters

  • self: LuaMap<string, unknown> | PlainTable — Script instance

fade_tail(self: LuaMap<string, unknown> | PlainTable, dt: number, data_arr: LuaTable, data_from: number)

Fade the tail of the trail by decreasing the alpha value of the tail points

Parameters

  • self: LuaMap<string, unknown> | PlainTable — Script instance
  • dt: number — Delta time
  • data_arr: LuaTable — Array of trail point data
  • data_from: number — Starting index for fading. ⚠️ 1-based; passed to hyper_trails unchanged.

follow_position(self: LuaMap<string, unknown> | PlainTable, dt: number)

Update trail position and properties based on object movement

Parameters

  • self: LuaMap<string, unknown> | PlainTable — Script instance
  • dt: number — Delta time

get_head_data_points(self: LuaMap<string, unknown> | PlainTable): LuaMultiReturn<[LuaTable, LuaTable]>

Get the two points at the head of the trail

Parameters

  • self: LuaMap<string, unknown> | PlainTable — Script instance

Returns

  • LuaTable — Previous head point
  • LuaTable — Current head point

get_position(self: LuaMap<string, unknown> | PlainTable): Vector3

Get current position of the trail object

Parameters

  • self: LuaMap<string, unknown> | PlainTable — Script instance

Returns

  • Vector3 — Current position

init_data_points(self: LuaMap<string, unknown> | PlainTable)

Initialize trail data points

Parameters

  • self: LuaMap<string, unknown> | PlainTable — Script instance

init_buffers(self: LuaMap<string, unknown> | PlainTable)

Initialize mesh buffers for trail rendering

Parameters

  • self: LuaMap<string, unknown> | PlainTable — Script instance

final(self: LuaMap<string, unknown> | PlainTable)

Clean up resources on script destruction

Parameters

  • self: LuaMap<string, unknown> | PlainTable — Script instance

init_props(self: LuaMap<string, unknown> | PlainTable)

Initialize trail properties

Parameters

  • self: LuaMap<string, unknown> | PlainTable — Script instance

init_vars(self: LuaMap<string, unknown> | PlainTable)

Initialize internal variables

Parameters

  • self: LuaMap<string, unknown> | PlainTable — Script instance

make_angle(diff_pos: Vector3): number

Calculate angle from position difference

Parameters

  • diff_pos: Vector3 — Position difference vector

Returns

  • number — Angle in radians

make_vectors_from_angle(self: LuaMap<string, unknown> | PlainTable, row: LuaTable)

Generate perpendicular vectors for trail width based on angle

Parameters

  • self: LuaMap<string, unknown> | PlainTable — Script instance
  • row: LuaTable — Trail point data row

pull_not_used_points(self: LuaMap<string, unknown> | PlainTable, data_arr: LuaTable, data_from: number)

Fill with zeros unused trail points

Parameters

  • self: LuaMap<string, unknown> | PlainTable — Script instance
  • data_arr: LuaTable — Array of trail point data
  • data_from: number — Starting index for unused points. ⚠️ 1-based; passed to hyper_trails unchanged.

shrink_length(self: LuaMap<string, unknown> | PlainTable, dt: number, data_arr: LuaTable, data_from: number)

Shrink trail length over time

Parameters

  • self: LuaMap<string, unknown> | PlainTable — Script instance
  • dt: number — Delta time
  • data_arr: LuaTable — Array of trail point data
  • data_from: number — Starting index for shrinking. ⚠️ 1-based; passed to hyper_trails unchanged.

shrink_width(self: LuaMap<string, unknown> | PlainTable, dt: number, data_from: number, data_arr: LuaTable, data_limit: number)

Shrink trail width from head to tail

Parameters

  • self: LuaMap<string, unknown> | PlainTable — Script instance
  • dt: number — Delta time
  • data_from: number — Starting index. ⚠️ 1-based; passed to hyper_trails unchanged.
  • data_arr: LuaTable — Array of trail point data
  • data_limit: number — Maximum points to process

split_segments_by_length(self: LuaMap<string, unknown> | PlainTable)

Split trail segments that exceed maximum length

Parameters

  • self: LuaMap<string, unknown> | PlainTable — Script instance

update_uv_opts(self: LuaMap<string, unknown> | PlainTable)

Update UV options for trail texture

Parameters

  • self: LuaMap<string, unknown> | PlainTable — Script instance

On this page