Macaw OS C reference

Function pick

#include <macaw3d.h>
int pick(
    double ox,
    double oy,
    double oz,
    double dx,
    double dy,
    double dz,
    double max,
    hit3d *hit
);

Finds the nearest pickable thing along a ray, such as a line of sight or a shot.

Parameters

oxdouble
Where the ray starts across, in world units.
oydouble
The height the ray starts at.
ozdouble
Where the ray starts along z.
dxdouble
The across part of the ray's direction. It can be any length.
dydouble
The up part of the ray's direction.
dzdouble
The z part of the ray's direction.
maxdouble
How far along the ray to look, in world units. 0 or less: no limit.
hithit3d *
Where to put what was hit: pass the address of a hit3d, like &hit (or NULL).

Returns int

The number of the thing it hit, or 0 if it hit nothing.

In The scene, with render, updateworld, collisions, resetcollisions, ambient, clearworld.