Game Development Reference
In-Depth Information
For each particle we'll need to keep track of various properties: we'll need its cur-
rent position, its velocity, and its acceleration. We will add additional properties to
the particle as we go. The position, velocity, and acceleration are all vectors.
The particle can be implemented with the following structure:
Excerpt from include/cyclone/particle.h
* A particle is the simplest object that can be simulated in the
* physics system.
class Particle
* Holds the linear position of the particle in
* world space.
Vector3 position;
* Holds the linear velocity of the particle in
* world space.
Vector3 velocity;
* Holds the acceleration of the particle. This value
* can be used to set acceleration due to gravity (its primary
* use) or any other constant acceleration.
Vector3 acceleration;
Using this structure we can apply some basic physics to create our first physics engine.
There are three law of motion posited by Newton, but for now we will need only the
first two. They deal with the way an object behaves in the presence and absence of
forces. The first two laws of motion are:
1. An object continues with a constant velocity unless a force acts upon it.
Search Nedrilad ::

Custom Search