njCollisionCheckBS Japanese
<-|INDEX|->
Checking for collision for a hexahedron and a sphere.

FORMAT

#include <Ninja.h>
Int njCollisionCheckBS( *box, *sphere )
NJS_BOX *box
NJS_SPHERE *sphere

PARAMETERS

*box
Hexahedron to be collision checked
*sphere
Sphere to be collision checked

RETURN VALUE

1: Hit
0: Not hit

ERROR VALUE

None

FUNCTION

Checks collision for a hexahedron and a sphere.

EXAMPLE

Hexahedron (box) and sphere (sphere) collision checking.
NJS_BOX box;
NJS_SPHERE sphere;

box.v[0].x = -150.f; box.v[0].y =  100.f; box.v[0].z =  100;
box.v[1].x = -150.f; box.v[1].y =  100.f; box.v[1].z = -100;
box.v[2].x =   50.f; box.v[2].y =  100.f; box.v[2].z = -100;
box.v[3].x =   50.f; box.v[3].y =  100.f; box.v[3].z =  100;
box.v[4].x = -150.f; box.v[4].y = -100.f; box.v[4].z =  100;
box.v[5].x = -150.f; box.v[5].y = -100.f; box.v[5].z = -100;
box.v[6].x =   50.f; box.v[6].y = -100.f; box.v[6].z = -100;
box.v[7].x =   50.f; box.v[7].y = -100.f; box.v[7].z =  100;

sphere.c.x = 100.f;
sphere.c.y =   0.f;
sphere.c.z =   0.f;
sphere.r   = 100.f;

njCollisionCheckBS(&box, &sphere);

Result
Return value: 1

NOTES

NJS_BOX structure(box type)
typedef struct{
    NJS_POINT3 v[8]; /* vertex list for hexahedron */
} NJS_BOX;
Corresponding vertices with vertex list index

NJS_SPHERE structure(sphere)
typedef struct{
    NJS_POINT3 c;/* center of the sphere */
    Float      r;/* radius of the sphere */
} NJS_SPHERE;
A sphere consists of center coordinate c and radius r.

RELATED TOPICS


njCollisionCheckBS
<-|INDEX|->

Copyright SEGA ENTERPRISES, LTD., 1997