physics.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void PhysicsUpdate (CWorld *ThisWorld)
 main physics engine
void PhysicsDampedCollision (CObject *ObjA, CObject *ObjB)
 perform damped collision response simulation
void PhysicsElasticCollision (CObject *ObjA, CObject *ObjB)
 perform elastic collision response simulation
void PhysicsStop (CObject *ObjA, CObject *ObjB)
 halt an object
void PhysicsReflect (CWorld *ThisWorld, CObject *ObjA, CObject *ObjB)
 reflect an object's velocity
void UpdateBody (CObject *body, float timeDelta)
 update body's position & orientation
void DamageRadius (CWorld *ThisWorld, Vector pos, float rad, float dam)
 damages objects within a certain range


Function Documentation

void DamageRadius ( CWorld ThisWorld,
Vector  pos,
float  rad,
float  dam 
)

This function inflicts damage on world objects based on their proximity to a 2D position passed as a vector to this function, and a radius value. Also a damage factor is passed to describe the amount of damage to be taken when the object in question is at a distance of zero from the origin of the damage area.

Definition at line 319 of file physics.cpp.

References CObject::iHealth, CObject::iType, Vector::Magnitude(), CObject::Next, CWorld::Objects, CObject::Position, TYPEID_WALL_BLOCK, and CObject::Velocity.

Referenced by RemoveDeadObjects().

Here is the call graph for this function:

Here is the caller graph for this function:

void PhysicsDampedCollision ( CObject ObjA,
CObject ObjB 
)

Simulate a damped collision response resulting from ObjA colliding with ObjB.

Definition at line 141 of file physics.cpp.

Referenced by Collide().

Here is the caller graph for this function:

void PhysicsElasticCollision ( CObject ObjA,
CObject ObjB 
)

Simulate a elastic collision response resulting from ObjA colliding with ObjB.

Definition at line 152 of file physics.cpp.

Referenced by Collide().

Here is the caller graph for this function:

void PhysicsReflect ( CWorld ThisWorld,
CObject ObjA,
CObject ObjB 
)

Reflect ObjA's velocity with respect to ObjB's position relative to ObjA. For example, if ObjA is below ObjB and ObjA is moving upwards, reflect ObjA's velocity along the Y axis.

Definition at line 209 of file physics.cpp.

References CWorld::AddEffect(), EFFECTID_MINISHOCK, CObject::iType, CEffect::MShock, CObject::Position, MiniShock::SetColor(), TYPEID_BOUNCY_SHOT, CObject::Velocity, Vector::x, and Vector::y.

Referenced by Collide().

Here is the call graph for this function:

Here is the caller graph for this function:

void PhysicsStop ( CObject ObjA,
CObject ObjB 
)

Stop object A, relative to object B.

Definition at line 162 of file physics.cpp.

References CObject::OldPosition, CObject::Position, CObject::Velocity, Vector::x, and Vector::y.

Referenced by Collide().

Here is the caller graph for this function:

void PhysicsUpdate ( CWorld ThisWorld  ) 

Do all the physics calculations here, updating the referenced world's objects positions.

Definition at line 33 of file physics.cpp.

References CObject::fAngle, CObject::fSubAngle, GameLogicFire(), CObject::iInput, INPUT_FIRE, INPUT_LEFT, CObject::iOwnCount, CObject::Next, NUM_PLAYERS, CWorld::Objects, CObject::OldPosition, CWorld::Player, and CObject::Position.

Referenced by PlayGame().

Here is the call graph for this function:

Here is the caller graph for this function:

void UpdateBody ( CObject body,
float  timeDelta 
)

This function updates a world object's physical properties based on the physics model implemented in the game. Effects such as friction are taken in to account and applied to model the objects physical behavior as it exists in the game environment.

Definition at line 273 of file physics.cpp.

References DegreesToRadians(), CObject::fAngle, CObject::iType, Vector::Magnitude(), MAX_TANK_SPEED, TANK_FCR_LATERAL, TANK_FCR_MEDIAL, TYPEID_TANK, TYPEID_WOOD_BLOCK, CObject::Velocity, VRotate2D(), Vector::x, Vector::y, and Vector::z.

Here is the call graph for this function:

 

Copyright Windsor Schmidt 2006 - All rights reserved.