Skip to content

collider_util_serialized

Source: base/tealdef/scripts/construction/collider_util_serialized.d.tl

Notes

Types of /scripts/construction/collider_util_serialized.tl (ColliderUtilSerialized): plain-table colliders (box, cylinder, point cloud) for construction results.

ColliderUtilSerialized

record global base/tealdef/scripts/construction/collider_util_serialized.d.tl:3

global record ColliderUtilSerialized

Load: local collider_util_serialized = require "/scripts/construction/collider_util_serialized.tl"

Notes

Collider helpers returned by ug_require "/scripts/construction/collider_util_serialized.tl".

Functions

createBox(center : Vec3Serialized.Vec3, halfExtents : Vec3Serialized.Vec3) : Collider base/tealdef/scripts/construction/collider_util_serialized.d.tl:41

Call as collider_util_serialized.createBox

Create a box collider.

Parameter Type Description
center Vec3Serialized.Vec3 center position of the box
halfExtents Vec3Serialized.Vec3 half-extents along each axis

Returns Collider: box collider

Used in the base game: 6 times in 4 files

base/content/stations/rail/rail/modular_station/modular_station.script.lua:969

table.insert(result.colliders, collider_util_serialized.createBox(vec3.new(coordI * 5, coordJ * platformLength - 17.5 + l * 5, 4), vec3.new(2.5, 2.5, 5)))
base/content/stations/air/air/airfield.script.lua:188
collider_util_serialized.createBox(vec3.new(midPoint, -13, 10), vec3.new(halfSize, 54, 20))
base/content/stations/air/air/airport.script.lua:237
collider_util_serialized.createBox(center, dimensions)
base/content/stations/air/air/airport/airport_modules.script.lua:18
collider_util_serialized.createBox(center, vec3.new(20, 15, 6))

createCylinder(direction? : ColliderUtilSerialized.Direction, center? : Vec3Serialized.Vec3, halfExtents? : Vec3Serialized.Vec3) : Collider base/tealdef/scripts/construction/collider_util_serialized.d.tl:47

Call as collider_util_serialized.createCylinder

Create a cylinder collider.

Parameter Type Description
direction? ColliderUtilSerialized.Direction axis direction of the cylinder, default (nil) is z-direction
center? Vec3Serialized.Vec3 center position of the cylinder, default (nil) is origin
halfExtents? Vec3Serialized.Vec3 half-extents along each axis, default (nil) is none

Returns Collider: cylinder collider

createPointCloud(points : {Vec3Serialized.Vec3}) : Collider base/tealdef/scripts/construction/collider_util_serialized.d.tl:51

Call as collider_util_serialized.createPointCloud

Create a point cloud collider.

Parameter Type Description
points {Vec3Serialized.Vec3} list of points forming the cloud

Returns Collider: point cloud collider

Used in the base game: 1 time in 1 file

base/content/scripts/scripts/construction/constructionutil.lua:338

local collider = collider_util_serialized.createPointCloud(points)

extrudePoints(points : {Vec3Serialized.Vec3}, offset1 : number, offset2 : number) : {Vec3Serialized.Vec3} base/tealdef/scripts/construction/collider_util_serialized.d.tl:58

Call as collider_util_serialized.extrudePoints

Extrude a list of points by offsetting them along the z-direction. Each point is hence added twice once with offset1 and once with offset2.

Parameter Type Description
points {Vec3Serialized.Vec3} input points to extrude
offset1 number offset for first set of extruded points
offset2 number offset for second set of extruded points

Returns {Vec3Serialized.Vec3}: extruded point list

ColliderUtilSerialized.Collider

record base/tealdef/scripts/construction/collider_util_serialized.d.tl:4

record Collider

Notes

A collision shape of a construction, as a plain table with type, transf and params.

Used in the base game: 7 times in 2 files

base/content/landmarks/hq/hq/headquarter.script.tl:363

local coll : ColliderUtilSerialized.Collider = {}
base/content/scripts/scripts/construction/collider_util_serialized.tl:6
collider_util_serialized.createBox = function(center : Vec3Serialized.Vec3, halfExtents : Vec3Serialized.Vec3) : ColliderUtilSerialized.Collider

Fields

Name Type Description
type Type Shape of the collider.
transf Mat4Serialized.Mat4 Transform matrix of collider
params Params Shape parameters of collider

ColliderUtilSerialized.Collider.Type

enum base/tealdef/scripts/construction/collider_util_serialized.d.tl:5

enum Type

Notes

Shape of a collider.

Value Description
"NONE" No collider shape
"BOX" Box-shaped collider
"CYLINDER" Cylinder-shaped collider
"POINT_CLOUD" Point cloud collider

ColliderUtilSerialized.Collider.Params

record base/tealdef/scripts/construction/collider_util_serialized.d.tl:16

record Params

Notes

Shape parameters; which field is used depends on type.

Fields

Name Type Description
halfExtents Vec3Serialized.Table3 Half-extents of the box or cylinder (x, y, z)
points {Vec3Serialized.Table3} Points used for a point cloud collider

ColliderUtilSerialized.Direction

enum base/tealdef/scripts/construction/collider_util_serialized.d.tl:30

enum Direction

Notes

Axis of a cylinder collider; without one (nil) the cylinder points along Z.

Used in the base game: 1 time in 1 file

base/content/scripts/scripts/construction/collider_util_serialized.tl:23

collider_util_serialized.createCylinder = function(direction : ColliderUtilSerialized.Direction, center : Vec3Serialized.Vec3, halfExtents : Vec3Serialized.Vec3

Value Description
"X" Along the X axis
"Y" Along the Y axis