Macaw OS C reference

Function leveltracebox

#include <macawlevel.h>
double leveltracebox(
    int level,
    double ax,
    double ay,
    double az,
    double bx,
    double by,
    double bz,
    double hx,
    double hy,
    double hz,
    double *nx,
    double *ny,
    double *nz,
    int *hit
);

Moves a box from one place towards another and tells you how far it gets before it hits something. Use it to move a player or a ball: it stops just short of the wall.

Parameters

levelint
The level to move through.
axdouble
X of the box's middle where it starts.
aydouble
Y of the box's middle where it starts.
azdouble
Z of the box's middle where it starts.
bxdouble
X of where the box's middle is going.
bydouble
Y of where the box's middle is going.
bzdouble
Z of where the box's middle is going.
hxdouble
Half the box's width along x (less than 0 counts as 0).
hydouble
Half the box's height.
hzdouble
Half the box's depth along z.
nxdouble *
The address of a double for x of the direction the thing it hit faces, or NULL.
nydouble *
The address of a double for y of that direction, or NULL.
nzdouble *
The address of a double for z of that direction, or NULL.
hitint *
The address of an int to get 1 if it hit something and 0 if not, or NULL.

Returns double

How far it got, from 0 (not at all) to 1 (all the way).

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