Help! With Positions

My GTA2 style game was coming along nicely until I got to collision detection. For collision detection I put my car in a bounding box and checked every vertice in the box against my city mesh and if no collision are detected then the car is moved to the destination. Now what I have relized is that my cars position is defined from its center so I would have to add the the box vertice I want to check with my cars position to get a accurate result.
Here's a picture -

v1|-0--0-|v4
| p | * view from top, v1-v4 are the boxes
v3|-0--0-|v5 vetices and p is the car's position.
so to check v1 for example I would
have to minus v1 from p,(both are
vectors) then check if it collides with
the mesh.

What I would like to know is if this is necessary, and if so how sould I go about doing it, since if v1 was smaller then pos I would have to minus v2 from pos, but if v1 was bigger than pos then I would have to minus pos from v1. I have tried every thing I could think of but my car still stops after the building is halfway though it.

I am using DirectX8 with VisualC++ 6.0. I load the map and car from X. files into seperate vertice buffers. I lock the vertice buffers and index buffers when I need access to the vertices.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories