"As a rule physical simulation by itself is not a big source of interest in a game. It is only a means to get a short path to acceptance by player."
FastCar has been initially designed to provide a set of tools for simulation in a racer game or a vehicle simulation application. The idea of the FastCar package was to cover aspects of work on dynamics common to different vehicle simulation application. It grew to the package with a set of complete collision detection solution and a multi-body engine.
With FastCar library you will be able to have cars driving on roads or terrain and colliding with walls, trees, posts. Cars rolling and hitting each other. You will be able to have objects like stones, balls, boxes or of any other shape interacting with ground, trees, walls, cars and each other. You'll be able to simulate systems of jointed bodies.
Car simulation features:
Multi-body features:
Collision detection features:
Other features:
Both single bodies and cars have virtually all possible get/set requests for positions, orientations, velocities, accelerations, forces; tools for saving/loading.
Structure of the complete package is the following:
Will all application using FastCar be the same? Not at all. They all will have common quality of good car physics and the behavior that is very easy to learn or adapt to. But different parameters will make all the FastCar instances substantially different.
You build a car by defining a number of physical and geometrical parameters such as mass and dimensions. You also set more involved parameters such as suspension stiffness and suspension damping. We have provided methods to automatically guess good values for all parameters that can cause difficulty.
To define the car you need to specify static parameters: 1) masses and moments of inertia of wheels and chassis, 2) positions and radii of wheels, 3) gravity, 4) suspension strength (there is a method to suggest a good value), 5) suspension damping factor (there is also a method to get good value and you will probably use it). These static parameters can be changed in run-time if necessary, for example, as the car gets damaged. Dynamic parameters such as position and velocity are continually changing in run-time. In run-time you have access to all quantities and can control everything.
For driving the vehicle your task is to provide collision detection information between the wheels and the ground. In particular, for every contact between a wheel and the ground you must supply three quantities: normal vector to the ground, position vector of contact point and penetration distance. This is quite standard among physics packages.
Some form of collision detection is present in most games, since interaction of objects based on distance is not uncommon in games. It is quite commonly accepted and in agreement with our experience that collision detection (CD) and collision culling or at least substantial parts of them are often specific to applications.
We provide many low-level CD routines and one "far field" implementation which you can use in your application.
The car library provides you with a simple interface to:
Set the mass, mass distribution and geometry of the car.
Set steering angle. There are various functions for this.
Set driving power of each wheel independently or through a gearbox.
Set the grip or friction of each wheel. Some wheels can run into an oil spot on the track, for example.
Set suspension stiffness and suspension damping.
Set brake strength for each wheel. E.g. one wheel can have a damaged bearing.
Set individual wheel hand brake state - this is a very strong brake that makes the wheel lock and stop moving.
Ask if a wheel is in skidding state or in a static friction state. Produce skidding sound with this.
Ask how far the car is from the point at which it starts skidding on a total or a per-wheel basis. With this feature traction controlled driving power can be applied. This appears to be very useful to get realistic and fast driving.
Get relative velocity of slip with the ground, you can connect skidding sound or sparkles to this.
Set different options and solving methods. For example, to get better tradeoff between speed, playability and physical correctness.
Work with forces and impulses in dozens of different functions.
Damping or air resistance in simple terms.
See also Overview of functionality.
If you have multiple cars or objects in a game they are completely independent: e.g. they can be integrated with different rates; some can be frozen; they can each have their own simulation options. At the same time you can do interactions between them such as collisions or joints. The library is versatile, yet at the same time very simple.