Macaw OS C reference

Function levelraycast

#include <macawlevel.h>
double levelraycast(
    int level,
    double x,
    double y,
    double z,
    double dx,
    double dy,
    double dz
);

Sends a ray from a point in a direction and finds where it first goes into a brush. It tries every brush, so it works straight after building. A ray that starts inside a brush doesn't count that one.

Parameters

levelint
The level to look through.
xdouble
X of where the ray starts.
ydouble
Y of where the ray starts.
zdouble
Z of where the ray starts.
dxdouble
How far the ray goes along x each step.
dydouble
How far the ray goes along y each step.
dzdouble
How far the ray goes along z each step.

Returns double

t, so the spot it hits is x + t * dx, y + t * dy, z + t * dz, or -1 if it hits nothing. If the direction is one unit long, t is the distance.

In Bumping into it, with leveltracebox, leveltrace, levelboxsolid, levelboxinside.