Luawe All pages

What world:raycast gives

world:raycast gives a table with these in it, or nil when the line meets nothing. Keep it in a variable (here it is called hit) and the editor shows these as you type. thing.particleHit and thing.particleTouched give one too, with a particle's speed in it.

hit.thingfunction

hit.thing: thing or nil

The thing the line met. For a particle: the thing it hit (nil at the water's or the path's edge, and when it touched the character).

hit.xfunction

hit.x: number

Where the line met it, from left to right, in tiles.

hit.yfunction

hit.y: number

Where the line met it, from top to bottom.

hit.distancefunction

hit.distance: number

How far along the line that is, in tiles (world:raycast only).

hit.normalXfunction

hit.normalX: number

The way the side it met faces, across: -1 to the left, 1 to the right, 0 neither. A bullet bounces off along it.

hit.normalYfunction

hit.normalY: number

The way the side it met faces, up and down: -1 up, 1 down.

hit.velocityXfunction

hit.velocityX: number

A particle's speed across as it hit, in tiles a beat (thing.particleHit and thing.particleTouched only).

hit.velocityYfunction

hit.velocityY: number

A particle's speed up and down as it hit, in tiles a beat: under 0 it went up.

hit.kindfunction

hit.kind: Collision

What a particle hit: cat.Collision.water, cat.Collision.path, cat.Collision.blocks or cat.Collision.custom (thing.particleHit only).

One of: water, path, blocks, custom.