Bruno

03-11-2001, 07:30 AM

Hi

I'm tryng to implement collision detection in my engine, but i'm having some problems,

I'm not using the brushes to detect colision, i'm just tryng to detect colision with the faces..,

Each face as this structure:

typedef struct

{

long start; // First face vertex in the array

long nVertices; // Number of vertices in the face

long TexID; // Texture indice into the texture array

long LmapID; // Lmap ID into the lightmaps array

plane_t p; // plane equation, four floats;

}Faces;

This structure is extracted from a q3 bsp file.

Ok, the way i'm tryng to detect is like this:

For each face,

Normal[0] = next_face->p.A;

Normal[1] = next_face->p.B;

Normal[2] = next_face->p.C;

// Here i get the distance from the camera

to the plane

d = DotProduct(Normal,camera);

d = abs(d);

//I got a radius of 20, from the camera to the planes

if(d<20)

{

colision=1;

}

This works with same planes, but not to all planes..why ? What i'm doing wrong here ?

p.s--> I'm not using curved surfaces.

thanks for any help,

Bruno

I'm tryng to implement collision detection in my engine, but i'm having some problems,

I'm not using the brushes to detect colision, i'm just tryng to detect colision with the faces..,

Each face as this structure:

typedef struct

{

long start; // First face vertex in the array

long nVertices; // Number of vertices in the face

long TexID; // Texture indice into the texture array

long LmapID; // Lmap ID into the lightmaps array

plane_t p; // plane equation, four floats;

}Faces;

This structure is extracted from a q3 bsp file.

Ok, the way i'm tryng to detect is like this:

For each face,

Normal[0] = next_face->p.A;

Normal[1] = next_face->p.B;

Normal[2] = next_face->p.C;

// Here i get the distance from the camera

to the plane

d = DotProduct(Normal,camera);

d = abs(d);

//I got a radius of 20, from the camera to the planes

if(d<20)

{

colision=1;

}

This works with same planes, but not to all planes..why ? What i'm doing wrong here ?

p.s--> I'm not using curved surfaces.

thanks for any help,

Bruno