Buy Me a Coffee at ko-fi.com

A global API which provides functions for raycasting

Raycasts based on a start position, an end position, and an array of Axis Aligned Bounding Boxes defined by the player.
AABBs are encoded as a table with indicies 1 and 2 being a Vector3.
`{vec(0,0,0),vec(1,0.5,1)}` is a valid AABB, with `{ {vec(0,0,0),vec(1,0.5,1)}, {vec(0,0.5,0.5),vec(1,1,1)} }` being a valid AABB array.
This function returns the AABB table that was hit, the exact position hit as a Vector3, the side of the AABB hit as a string or nil if inside an AABB, and the index of the AABB that was hit in the array

overload 1:
RaycastAPI.aabb(start: Vector3, end: Vector3, aabbs: Table): Varargs
typings.2002444080typings.2002444080typings.80563118typings.1901216868
Method PropertyFluent DescriptionRepresentation
start accepts
end accepts
aabbs accepts
Return Value
overload 2:
RaycastAPI.aabb(startX: Number, startY: Number, startZ: Number, end: Vector3, aabbs: Table): Varargs
typings.-1950496919typings.-1950496919typings.-1950496919typings.2002444080typings.80563118typings.1901216868
Method PropertyFluent DescriptionRepresentation
startX accepts
startY accepts
startZ accepts
end accepts
aabbs accepts
Return Value
overload 3:
RaycastAPI.aabb(start: Vector3, endX: Number, endY: Number, endZ: Number, aabbs: Table): Varargs
typings.2002444080typings.-1950496919typings.-1950496919typings.-1950496919typings.80563118typings.1901216868
Method PropertyFluent DescriptionRepresentation
start accepts
endX accepts
endY accepts
endZ accepts
aabbs accepts
Return Value
overload 4:
RaycastAPI.aabb(startX: Number, startY: Number, startZ: Number, endX: Number, endY: Number, endZ: Number, aabbs: Table): Varargs
typings.-1950496919typings.-1950496919typings.-1950496919typings.-1950496919typings.-1950496919typings.-1950496919typings.80563118typings.1901216868
Method PropertyFluent DescriptionRepresentation
startX accepts
startY accepts
startZ accepts
endX accepts
endY accepts
endZ accepts
aabbs accepts
Return Value

Raycasts a Block in the world.
If successful, returns the BlockState hit, the exact world position hit as a Vector3, and the side of the block that was hit.
When unsuccessful, returns nil.
blockCastType and fluidCastType determine how the raycast handles block shapes and fluids.
Will default to "COLLIDER" and "NONE" when nil

overload 1:
RaycastAPI.block(start: Vector3, end: Vector3, blockCastType: String, fluidCastType: String): Varargs
typings.2002444080typings.2002444080typings.-1808118735typings.-1808118735typings.1901216868
Method PropertyFluent DescriptionRepresentation
start accepts
end accepts
blockCastType accepts
fluidCastType accepts
Return Value
overload 2:
RaycastAPI.block(startX: Number, startY: Number, startZ: Number, end: Vector3, blockCastType: String, fluidCastType: String): Varargs
typings.-1950496919typings.-1950496919typings.-1950496919typings.2002444080typings.-1808118735typings.-1808118735typings.1901216868
Method PropertyFluent DescriptionRepresentation
startX accepts
startY accepts
startZ accepts
end accepts
blockCastType accepts
fluidCastType accepts
Return Value
overload 3:
RaycastAPI.block(start: Vector3, endX: Number, endY: Number, endZ: Number, blockCastType: String, fluidCastType: String): Varargs
typings.2002444080typings.-1950496919typings.-1950496919typings.-1950496919typings.-1808118735typings.-1808118735typings.1901216868
Method PropertyFluent DescriptionRepresentation
start accepts
endX accepts
endY accepts
endZ accepts
blockCastType accepts
fluidCastType accepts
Return Value
overload 4:
RaycastAPI.block(startX: Number, startY: Number, startZ: Number, endX: Number, endY: Number, endZ: Number, blockCastType: String, fluidCastType: String): Varargs
typings.-1950496919typings.-1950496919typings.-1950496919typings.-1950496919typings.-1950496919typings.-1950496919typings.-1808118735typings.-1808118735typings.1901216868
Method PropertyFluent DescriptionRepresentation
startX accepts
startY accepts
startZ accepts
endX accepts
endY accepts
endZ accepts
blockCastType accepts
fluidCastType accepts
Return Value

Raycasts an Entity in the world
If successful, returns the EntityAPI hit and the exact world position hit as a Vector3.
When unsuccessful, returns nil.
predicate is a function that prevents specific entities from being raycasted.
Takes in a single EntityAPI object. Return true for valid entities, false for invalid.
Marks all entities as valid when nil

overload 1:
RaycastAPI.entity(start: Vector3, end: Vector3, predicate: Function): Varargs
typings.2002444080typings.2002444080typings.1445582840typings.1901216868
Method PropertyFluent DescriptionRepresentation
start accepts
end accepts
predicate accepts
Return Value
overload 2:
RaycastAPI.entity(startX: Number, startY: Number, startZ: Number, end: Vector3, predicate: Function): Varargs
typings.-1950496919typings.-1950496919typings.-1950496919typings.2002444080typings.1445582840typings.1901216868
Method PropertyFluent DescriptionRepresentation
startX accepts
startY accepts
startZ accepts
end accepts
predicate accepts
Return Value
overload 3:
RaycastAPI.entity(start: Vector3, endX: Number, endY: Number, endZ: Number, predicate: Function): Varargs
typings.2002444080typings.-1950496919typings.-1950496919typings.-1950496919typings.1445582840typings.1901216868
Method PropertyFluent DescriptionRepresentation
start accepts
endX accepts
endY accepts
endZ accepts
predicate accepts
Return Value
overload 4:
RaycastAPI.entity(startX: Number, startY: Number, startZ: Number, endX: Number, endY: Number, endZ: Number, predicate: Function): Varargs
typings.-1950496919typings.-1950496919typings.-1950496919typings.-1950496919typings.-1950496919typings.-1950496919typings.1445582840typings.1901216868
Method PropertyFluent DescriptionRepresentation
startX accepts
startY accepts
startZ accepts
endX accepts
endY accepts
endZ accepts
predicate accepts
Return Value