Detects if an object intersects a line between from and to.
void raycast(vec3 from, vec3 to, out bool didHit, out vec3 hitPos, out obj hitObj)
Type: vec3
From position of the ray.
Type: vec3
To position of the ray.
Modifiers: out
Type: bool
If the ray hit an object.
Modifiers: out
Type: vec3
The position at which the ray intersected hitObj.
Modifiers: out
Type: obj
The object that was hit.
- Only detects the outside surface of a block. If it starts inside of a block, the block won't be detected.
- Won't detect object created on the same frame as the raycast is performed.
- Won't detect objects without collion or script blocks.
- If the raycast hits the floor, hitObj will be equal to null.