Game Development Reference
In-Depth Information
How it works…
There are several properties used while creating physics bodies to define their behavior in
the physics world. The following is a detailed description of the properties used in the pre-
ceding code:
Restitution property defines the bounciness of an object. Setting the restitution to
1.0f , means that the ball collision will be perfectly elastic with any object. This
means that the ball will bounce back with a force equal to the impact.
Linear Damping property allows the simulation of fluid or air friction. This is ac-
complished by reducing the linear velocity of the body. In our case, we do not want
the ball to slow down while moving and hence we have set the restitution to 0.0f .
Search WWH ::




Custom Search