All
collision detection will be handled outside of the Object Library by a separate
Collision class.
This class will detect collisions, notify each object that it has been hit and
apply the appropriate forces to the objects.
Each
Game Object will be responsible for its own movement.
Any movement that is independent of the other GameObjects should be handled
internally by the object itself.
Game Flow calls the Physics
class to handle collision detection.
It tests the Object Library's
GameObjects for collisions.
All physics method comparing different GameObjects are included in the Physics
class.
Forces are applied to Game Objects when a collision is detected.
Grid Tracking Using Textures
It will use a 2D "map-sized" grid to keep track of all the particles
in a given grid position.
Each particle will check the gridspace in the direction it intends to move to
and determine if it is about to collide with another particle.
This same algorithm is used for collision against props.
Collision Tests
Object/Terrain,
Particle/Prop, Particle/Player, Prop/Player, Player/Player, and Prop/Prop
It is a property of each Game Object.
The GameObject should manipulate the properties of it's Mass Object
to dictate it's own movement in space.
A mass object is accted upon by applying a general force, gravity, or friction
to it using vectors R-GW-10
Contains
variables such as mass, velocity, acceleration, friction, etc., to hold all
the physical properties of an object.
The object orientation is quaternion based.
The current rotation is stored in a Quaternion and applied to the Up, Normal and
Perpendicular vectors to orient the local coordinate system. This allows for a clean way of
rotating the object without gimbal lock.
When Rotate() is called we can create two quaternions: one for up/down rotations and one for left/right rotations.
The up/down rotation is around the perpendicular vector as the axis and the left/right rotation is around the up vector.
We must also limit the up/down rotation so the player can't become upside-down. This is done by calculating the angle
between the normal and the Y-axis to ensure that its within a certain range.