#include <Body.h>
Class Body
Inherits from Component
Implements newtonian physics.
Definition at line 99 of file Body.h.
# BodyROMSpec
A Body spec that is stored in ROM
Definition at line 78 of file Body.h.
# applyForce()
Apply a force to the body.
- Parameters
-
Definition at line 345 of file Body.c.
# bounce()
Make the body to bounce on the profixed plane according to the provided friction and bounciness.
- Parameters
-
bounceReferent | Referent of the normal to the plane on which the body has to bounce |
bouncingPlaneNormal | Normal of the plane on which the body has to bounce |
frictionCoefficient | Friction coefficient of the bounce referent |
bounciness | Bounciness coefficient of the bounce referent |
Definition at line 385 of file Body.c.
# clearNormal()
Remove any normal vector affecting the body belonging to the provided referent.
- Parameters
-
referent | Normal vector affecting the body's owner |
Definition at line 253 of file Body.c.
# computeInstantaneousSpeed()
Compute the instantaneous speed caused by the provided physical properties.
- Parameters
-
forceMagnitude | Magnitude of the applied force |
gravity | Gravity acceleration vector that affects the resulting speed |
mass | The mass that will aquire the computed speed |
friction | Friction affecting the mass that will aquire the computed speed |
maximumSpeed | Maximum value that the computated speed can reach |
- Returns
- The instantaneous speed caused by the provided physical properties
Definition at line 106 of file Body.c.
# constructor()
Class' constructor
- Parameters
-
owner | Entity to which the body attaches to |
bodySpec | Struct that specifies the physical properties of bodies |
Definition at line 147 of file Body.c.
# getAxisForSynchronizationWithBody()
uint16 Body::getAxisForSynchronizationWithBody |
( |
| ) |
|
Retrieve the axises around which the owner's rotation must be synchronized.
- Returns
- Flag containing the axises around which the owner is subject to rotation synchronization
Definition at line 645 of file Body.c.
# getAxisSubjectToGravity()
uint16 Body::getAxisSubjectToGravity |
( |
| ) |
|
Retrieve the axises on which the body is subject to gravity.
- Returns
- Flag containing the axises on which the body is subject to gravity
Definition at line 631 of file Body.c.
# getBounciness()
Retrieve the body's bounciness factor.
- Returns
- Body's bounciness factor
Definition at line 668 of file Body.c.
# getDirection()
Retrieve the direction towards which the body is moving.
Definition at line 614 of file Body.c.
# getElapsedTimeStep()
static fixed_t Body::getElapsedTimeStep |
( |
| ) |
|
|
static |
Retrieve the time that passes between each physical simulation step.
- Returns
- The time that passes between each physical simulation step
Definition at line 99 of file Body.c.
# getFrictionCoefficient()
fixed_t Body::getFrictionCoefficient |
( |
| ) |
|
Retrieve the body's friction coefficient.
- Returns
- Body's friction coefficient
Definition at line 692 of file Body.c.
# getMass()
Retrieve the body's mass.
- Returns
- Body's mass
Definition at line 706 of file Body.c.
# getMaximumSpeed()
Retrieve the body's maximum speed.
- Returns
- Maximum magnitude of the body's velocity
Definition at line 755 of file Body.c.
# getMaximumVelocity()
Retrieve the body's maximum velocity.
- Returns
- 3D vector defining the body's maximum speed on each axis (only applicable when the body's movement is independent on each axis)
Definition at line 741 of file Body.c.
# getMovementOnAllAxis()
uint16 Body::getMovementOnAllAxis |
( |
| ) |
|
Retrieve the body's current movement state
- Returns
- Flag containing the body's current movement state on each axis
Definition at line 801 of file Body.c.
# getPosition()
Retrieve the body's position.
- Returns
- Pointer to the body's 3D vector defining its position
Definition at line 727 of file Body.c.
# getSpeed()
Retrieve the body's current speed (velocity vector's magnitude).
- Returns
- Body's current speed (velocity vector's magnitude)
Definition at line 794 of file Body.c.
# getVelocity()
Retrieve the current velocity at which the body move.
- Returns
- Pointer to the body's velocity vector
Definition at line 590 of file Body.c.
# handleCommand()
void Body::handleCommand |
( |
int32 | command, |
|
|
va_list | args ) |
|
virtual |
Handle a command.
- Parameters
-
command | Command to handle |
args | Variable arguments list depending on the command to handle |
Reimplemented from Component.
Definition at line 218 of file Body.c.
# print()
Print the body's properties.
- Parameters
-
x | Screen x coordinate where to print |
y | Screen y coordinate where to print |
Definition at line 830 of file Body.c.
# reset()
Clear the body's state.
Definition at line 231 of file Body.c.
# sendMessages()
void Body::sendMessages |
( |
bool | value | ) |
|
Set the flag that enables or prevents the sending of messages to the body's owner about its state changes.
- Parameters
-
value | If true, the body sends messages to its owner when its movement state changes |
# setAxisForSynchronizationWithBody()
void Body::setAxisForSynchronizationWithBody |
( |
uint16 | axisForSynchronizationWithBody | ) |
|
Set the axises around which the owner's rotation must be synchronized.
- Parameters
-
axisForSynchronizationWithBody | Flag containing the axises around which the owner must be subject to rotation synchronization |
Definition at line 638 of file Body.c.
# setAxisSubjectToGravity()
void Body::setAxisSubjectToGravity |
( |
uint16 | axisSubjectToGravity | ) |
|
Set the axises on which the body is subject to gravity.
- Parameters
-
axisSubjectToGravity | Flag containing the axises on which the body is subject to gravity |
Definition at line 621 of file Body.c.
# setBounciness()
void Body::setBounciness |
( |
fixed_t | bounciness | ) |
|
Set the body's bounciness factor.
- Parameters
-
bounciness | Value to set as the body's bounciness factor (between 0 and 1) |
Definition at line 652 of file Body.c.
# setDirection()
void Body::setDirection |
( |
const Vector3D * | direction | ) |
|
Set the direction towards which the body must move.
- Parameters
-
direction | Pointer to a direction vector |
Definition at line 597 of file Body.c.
# setFrictionCoefficient()
void Body::setFrictionCoefficient |
( |
fixed_t | frictionCoefficient | ) |
|
Set the body's friction coefficient.
- Parameters
-
frictionCoefficient | Value to set as the body's friction coefficient (between 0 and __MAXIMUM_FRICTION_COEFFICIENT) |
Definition at line 675 of file Body.c.
# setGlobalFrictionCoefficient()
static void Body::setGlobalFrictionCoefficient |
( |
fixed_t | frictionCoefficient | ) |
|
|
static |
Set the current global gravity.
- Parameters
-
frictionCoefficient | Value to set as the body's friction coefficient (between 0 and __MAXIMUM_FRICTION_COEFFICIENT) |
Definition at line 92 of file Body.c.
# setGlobalGravity()
static void Body::setGlobalGravity |
( |
Vector3D | gravity | ) |
|
|
static |
Set the current global gravity.
- Parameters
-
gravity | Gravity to set in the current physical world |
Definition at line 85 of file Body.c.
# setMass()
Set the body's mass.
- Parameters
-
mass | Value to set as the body's mass (between 0.01f and 1) |
Definition at line 699 of file Body.c.
# setMaximumSpeed()
void Body::setMaximumSpeed |
( |
fixed_t | maximumSpeed | ) |
|
Set the body's maximum speed.
- Parameters
-
maximumSpeed | Maximum magnitude of the body's velocity |
Definition at line 748 of file Body.c.
# setMaximumVelocity()
void Body::setMaximumVelocity |
( |
Vector3D | maximumVelocity | ) |
|
Set the body's maximum velocity.
- Parameters
-
maximumVelocity | 3D vector defining the body's maximum speed on each axis (only applicable when the body's movement is independent on each axis) |
Definition at line 734 of file Body.c.
# setPosition()
Set the body's position.
- Parameters
-
position | 3D vector defining the body's new position |
caller | Must be the body's owner; otherwise the call to this method doesn't have any effect |
Definition at line 713 of file Body.c.
# setSkipCycles()
void Body::setSkipCycles |
( |
int8 | skipCycles | ) |
|
Set the number of cycles to wait before updating the physics simulations on the body.
- Parameters
-
skipCycles | Number of cycles to skip physical simulations to slow down physics |
Definition at line 769 of file Body.c.
# setSurroundingFrictionCoefficient()
void Body::setSurroundingFrictionCoefficient |
( |
fixed_t | surroundingFrictionCoefficient | ) |
|
Set the body's friction coefficient of the its surroundings.
- Parameters
-
surroundingFrictionCoefficient | Body's friction coefficient of the its surroundings |
Definition at line 777 of file Body.c.
# setVelocity()
void Body::setVelocity |
( |
const Vector3D * | velocity | ) |
|
Set a constant velocity at which the body must move.
- Parameters
-
velocity | Pointer to a velocity vector |
Definition at line 546 of file Body.c.
# stopMovement()
Stop the body's movement on the speficied axis.
- Parameters
-
axis | Flag indicating the axises on which the movement has to stop |
- Returns
- Flag indicatiing the actual axises on which the body's movement stopped
Definition at line 499 of file Body.c.
# update()
Update the physics simulation on the body.
- Parameters
-
cycle | Cycle number during the current second |
elapsedTime | Elapsed time since the last call to this method |
Definition at line 285 of file Body.c.
# accelerating
Flags for the acceleration state of the body on each axis.
Definition at line 143 of file Body.h.
# awake
If not true, the body skips physical simulations.
Definition at line 179 of file Body.h.
# axisForSynchronizationWithBody
uint16 Body::axisForSynchronizationWithBody |
|
protected |
Axises around which to rotate the owner when syncronizing with body.
Definition at line 170 of file Body.h.
# axisSubjectToGravity
uint16 Body::axisSubjectToGravity |
|
protected |
Axises on which the body is subject to gravity.
Definition at line 167 of file Body.h.
# bounciness
# direction
# externalForce
External applied force.
Definition at line 131 of file Body.h.
# friction
Friction surrounding object.
Definition at line 134 of file Body.h.
# frictionCoefficient
Friction coefficient of the body.
Definition at line 149 of file Body.h.
# frictionForceMagnitude
fixed_t Body::frictionForceMagnitude |
|
protected |
Total friction force magnitude affecting the body.
Definition at line 158 of file Body.h.
# gravity
Gravity affecting the body.
Definition at line 128 of file Body.h.
# internalPosition
Spatial position at higher decimal precision.
Definition at line 107 of file Body.h.
# internalVelocity
Velocity vector at higher decimal precision.
Definition at line 113 of file Body.h.
# mass
# maximumSpeed
Maximum speed.
Definition at line 125 of file Body.h.
# maximumVelocity
Maximum velocity.
Definition at line 119 of file Body.h.
# movementType
Body's movement type on each axis.
Definition at line 164 of file Body.h.
# movesIndependentlyOnEachAxis
bool Body::movesIndependentlyOnEachAxis |
|
protected |
If true, the movement of the body is independent on each axis.
Definition at line 185 of file Body.h.
# normals
List of normal for the forces affecting the body.
Definition at line 140 of file Body.h.
# position
Spatial position.
Definition at line 104 of file Body.h.
# sendMessages
If true, the body informs its owner of its change in movement state.
Definition at line 182 of file Body.h.
# skipCycles
Number of cycles to skip physical simulations to slow down physics.
Definition at line 173 of file Body.h.
# skipedCycles
Number of skiped cycles.
Definition at line 176 of file Body.h.
# speed
Speed magnitude.
Definition at line 122 of file Body.h.
# surroundingFrictionCoefficient
fixed_t Body::surroundingFrictionCoefficient |
|
protected |
Friction coefficient of the body's surroundings.
Definition at line 152 of file Body.h.
# totalFrictionCoefficient
fixed_t Body::totalFrictionCoefficient |
|
protected |
Friction force's magnitude.
Definition at line 155 of file Body.h.
# totalNormal
Total normal forces applied to the body.
Definition at line 137 of file Body.h.
# velocity
Velocity vector.
Definition at line 110 of file Body.h.
The documentation for this class was generated from the following files:
- VUEngine-Core/source/Component/Body/Body.h
- VUEngine-Core/source/Component/Body/Body.c