There are many racing game physics that can be implemented such as gravity, friction, engine physics, car dynamics and springs physics. These physics are important to achieve realism in game play. For this project, the basic law of motion and collision detection will be implemented as shown in Figure 3‑9. These include:
- Car moves towards as the accelerate key is pushed or moves backwards if the reverse key is pushed.
- Some elements may pull the car back or slow it down such as friction or braking.
- Gravity pulls the car down and keeps the car on the road.
Objects that are moving through the world need to be checked against the geometry and all other objects in the world to see that it does not pass through or get too close to any of them. For instance, I would check if any of the four wheels collide with the guard rail by checking the four wheel positions
Check all 4 corner points of the car.
For all 4 corners {
Determine the distance between the corner to the rail.
If it less than or equal 0 then
{
Collision happens.
Bring out the collision event
{
I. 2nd law of motion, force the car back on the road and reduce speed.
II. Determine the collision impulse and show collision effects.
III. Play collision sound
IV. Shake camera.
}
}
No comments:
Post a Comment