|  | overview |  | wiki |  | api reference |  | download

- Main Page
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Functions Variables Typedefs Enumerations Enumerator
Classes | Public Member Functions | Protected Member Functions
gameplay::PhysicsRigidBody Class Reference

`#include <PhysicsRigidBody.h>`

Inheritance diagram for gameplay::PhysicsRigidBody:

List of all members.

## Classes

struct | Parameters

## Public Member Functions

PhysicsCollisionObject::Type | getType () const
float | getMass () const
float | getFriction () const
void | setFriction (float friction)
float | getRestitution () const
void | setRestitution (float restitution)
float | getLinearDamping () const
float | getAngularDamping () const
void | setDamping (float linearDamping, float angularDamping)
Vector3 | getLinearVelocity () const
void | setLinearVelocity (const Vector3 &velocity)
void | setLinearVelocity (float x, float y, float z)
Vector3 | getAngularVelocity () const
void | setAngularVelocity (const Vector3 &velocity)
void | setAngularVelocity (float x, float y, float z)
Vector3 | getAnisotropicFriction () const
void | setAnisotropicFriction (const Vector3 &friction)
void | setAnisotropicFriction (float x, float y, float z)
Vector3 | getGravity () const
void | setGravity (const Vector3 &gravity)
void | setGravity (float x, float y, float z)
Vector3 | getAngularFactor () const
void | setAngularFactor (const Vector3 &angularFactor)
void | setAngularFactor (float x, float y, float z)
Vector3 | getLinearFactor () const
void | setLinearFactor (const Vector3 &linearFactor)
void | setLinearFactor (float x, float y, float z)
void | setKinematic (bool kinematic)
void | setEnabled (bool enable)
float | getHeight (float x, float z) const
bool | isStatic () const
void | applyForce (const Vector3 &force, const Vector3 *relativePosition=NULL)
void | applyImpulse (const Vector3 &impulse, const Vector3 *relativePosition=NULL)
void | applyTorque (const Vector3 &torque)
void | applyTorqueImpulse (const Vector3 &torque)

## Protected Member Functions

btCollisionObject * | getCollisionObject () const

## Detailed Description

Defines a class for physics rigid bodies.

A rigid body can receive forces and torque to make your objects react to other collision objects around it.

See also:
  http://gameplay3d.github.io/GamePlay/docs/file-formats.html#wiki-Collision_Objects

## Member Function Documentation

void gameplay::PhysicsRigidBody::applyForce | ( | const Vector3 & | force,
|  | const Vector3 * | relativePosition = `NULL`
| ) |  |

Applies the given force to the rigid body (optionally, from the given relative position). Note that the total force applied depends on the duration of the next frame. If you want to apply an "impulse" irrespective of the frame duration, consider using applyImpulse.

Parameters:

  force | The force to be applied.
  relativePosition | The relative position from which to apply the force.

void gameplay::PhysicsRigidBody::applyImpulse | ( | const Vector3 & | impulse,
|  | const Vector3 * | relativePosition = `NULL`
| ) |  |

Applies the given force impulse to the rigid body (optionally, from the given relative position).

Parameters:

  impulse | The force impulse to be applied.
  relativePosition | The relative position from which to apply the force.

void gameplay::PhysicsRigidBody::applyTorque | ( | const Vector3 & | torque | ) |

Applies the given torque to the rigid body.

Parameters:

  torque | The torque to be applied.

void gameplay::PhysicsRigidBody::applyTorqueImpulse | ( | const Vector3 & | torque | ) |

Applies the given torque impulse to the rigid body.

Parameters:

  torque | The torque impulse to be applied.

float gameplay::PhysicsRigidBody::getAngularDamping | ( |  | ) | const`[inline]`

Gets the rigid body's angular damping.

Returns:
  The angular damping.

Vector3 gameplay::PhysicsRigidBody::getAngularFactor | ( |  | ) | const`[inline]`

Gets the rigid body's angular factor.

Returns:
  The angular factor.

Vector3 gameplay::PhysicsRigidBody::getAngularVelocity | ( |  | ) | const`[inline]`

Gets the rigid body's angular velocity.

Returns:
  The angular velocity.

Vector3 gameplay::PhysicsRigidBody::getAnisotropicFriction | ( |  | ) | const`[inline]`

Gets the rigid body's anisotropic friction.

Returns:
  The anisotropic friction.

btCollisionObject* gameplay::PhysicsRigidBody::getCollisionObject | ( |  | ) | const`[protected, virtual]`

See also:
  PhysicsCollisionObject::getCollisionObject

Implements gameplay::PhysicsCollisionObject.

float gameplay::PhysicsRigidBody::getFriction | ( |  | ) | const`[inline]`

Gets the rigid body's friction.

Returns:
  The friction.

Vector3 gameplay::PhysicsRigidBody::getGravity | ( |  | ) | const`[inline]`

Gets the gravity that affects the rigid body (this can be different from the global gravity;

See also:
  setGravity(Vector3)).

Returns:
  The gravity.

float gameplay::PhysicsRigidBody::getHeight | ( | float | x,
|  | float | z
| ) |  | const

Gets the height at the given point (only for rigid bodies of type HEIGHTFIELD).

Parameters:

  x | The x position, in world space.
  z | The z position, in world space.

Returns:
  The height at the given point, or zero if this is not a heightfield rigid body.

float gameplay::PhysicsRigidBody::getLinearDamping | ( |  | ) | const`[inline]`

Gets the rigid body's linear damping.

Returns:
  The linear damping.

Vector3 gameplay::PhysicsRigidBody::getLinearFactor | ( |  | ) | const`[inline]`

Gets the rigid body's linear factor.

Returns:
  The linear factor.

Vector3 gameplay::PhysicsRigidBody::getLinearVelocity | ( |  | ) | const`[inline]`

Gets the rigid body's linear velocity.

Returns:
  The linear velocity.

float gameplay::PhysicsRigidBody::getMass | ( |  | ) | const`[inline]`

Gets the rigid body's mass.

Returns:
  The mass.

float gameplay::PhysicsRigidBody::getRestitution | ( |  | ) | const`[inline]`

Gets the rigid body's restitution.

Returns:
  The restitution.

PhysicsCollisionObject::Type gameplay::PhysicsRigidBody::getType | ( |  | ) | const`[virtual]`

See also:
  PhysicsCollisionObject::getType

Implements gameplay::PhysicsCollisionObject.

bool gameplay::PhysicsRigidBody::isStatic | ( |  | ) | const

Gets whether the rigid body is a static rigid body or not.

Returns:
  Whether the rigid body is static.

Reimplemented from gameplay::PhysicsCollisionObject.

void gameplay::PhysicsRigidBody::setAngularFactor | ( | const Vector3 & | angularFactor | ) | `[inline]`

Sets the rigid body's angular factor. x, y, z coordinates correspond to world space rotation along these axes. Use 1.0 to allow or 0.0 to disallow rotation along certain axis.

Parameters:

  angularFactor | angular factor vector

void gameplay::PhysicsRigidBody::setAngularFactor | ( | float | x,
|  | float | y,
|  | float | z
| ) |  | `[inline]`

Sets the rigid body's angular factor. x, y, z coordinates correspond to world space rotation along these axes. Use 1.0 to allow or 0.0 to disallow rotation along certain axis.

Parameters:

  x | The x coordinate of the angular factor vector.
  y | The y coordinate of the angular factor vector.
  z | The z coordinate of the angular factor vector.

void gameplay::PhysicsRigidBody::setAngularVelocity | ( | const Vector3 & | velocity | ) | `[inline]`

Sets the rigid body's angular velocity.

Parameters:

  velocity | The angular velocity.

void gameplay::PhysicsRigidBody::setAngularVelocity | ( | float | x,
|  | float | y,
|  | float | z
| ) |  | `[inline]`

Sets the rigid body's angular velocity.

Parameters:

  x | The x coordinate of the angular velocity vector.
  y | The y coordinate of the angular velocity vector.
  z | The z coordinate of the angular velocity vector.

void gameplay::PhysicsRigidBody::setAnisotropicFriction | ( | const Vector3 & | friction | ) | `[inline]`

Sets the rigid body's anisotropic friction.

Parameters:

  friction | The anisotropic friction.

void gameplay::PhysicsRigidBody::setAnisotropicFriction | ( | float | x,
|  | float | y,
|  | float | z
| ) |  | `[inline]`

Sets the rigid body's anisotropic friction.

Parameters:

  x | The x coordinate of the anisotropic friction.
  y | The y coordinate of the anisotropic friction.
  z | The z coordinate of the anisotropic friction.

void gameplay::PhysicsRigidBody::setDamping | ( | float | linearDamping,
|  | float | angularDamping
| ) |  | `[inline]`

Sets the rigid body's linear and angular damping.

Parameters:

  linearDamping | The linear damping; between 0.0 (minimum) and 1.0 (maximum).
  angularDamping | The angular damping; between 0.0 (minimum) and 1.0 (maximum).

void gameplay::PhysicsRigidBody::setEnabled | ( | bool | enable | ) |

Sets whether the rigid body is enabled or disabled in the physics world.

Parameters:

  enable | true enables the collision object, false disables it.

Reimplemented from gameplay::PhysicsCollisionObject.

void gameplay::PhysicsRigidBody::setFriction | ( | float | friction | ) | `[inline]`

Sets the rigid body's friction.

Parameters:

  friction | The friction.

void gameplay::PhysicsRigidBody::setGravity | ( | const Vector3 & | gravity | ) | `[inline]`

Sets the rigid body's gravity (this overrides the global gravity for this rigid body).

Parameters:

  gravity | The gravity.

void gameplay::PhysicsRigidBody::setGravity | ( | float | x,
|  | float | y,
|  | float | z
| ) |  | `[inline]`

Sets the rigid body's gravity (this overrides the global gravity for this rigid body).

Parameters:

  x | The x coordinate of the gravity vector.
  y | The y coordinate of the gravity vector.
  z | The z coordinate of the gravity vector.

void gameplay::PhysicsRigidBody::setKinematic | ( | bool | kinematic | ) |

Sets whether the rigid body is a kinematic rigid body or not.

Parameters:

  kinematic | Whether the rigid body is kinematic or not.

void gameplay::PhysicsRigidBody::setLinearFactor | ( | const Vector3 & | linearFactor | ) | `[inline]`

Sets the rigid body's linear factor. x, y, z coordinates correspond to world space motion along these axes. Use 1.0 to allow or 0.0 to disallow motion along certain axis.

Parameters:

  linearFactor | linear factor vector

void gameplay::PhysicsRigidBody::setLinearFactor | ( | float | x,
|  | float | y,
|  | float | z
| ) |  | `[inline]`

Sets the rigid body's linear factor. x, y, z coordinates correspond to world space motion along these axes. Use 1.0 to allow or 0.0 to disallow motion along certain axis.

Parameters:

  x | The x coordinate of the linear factor vector.
  y | The y coordinate of the linear factor vector.
  z | The z coordinate of the linear factor vector.

void gameplay::PhysicsRigidBody::setLinearVelocity | ( | const Vector3 & | velocity | ) | `[inline]`

Sets the rigid body's linear velocity.

Parameters:

  velocity | The linear velocity.

void gameplay::PhysicsRigidBody::setLinearVelocity | ( | float | x,
|  | float | y,
|  | float | z
| ) |  | `[inline]`

Sets the rigid body's linear velocity.

Parameters:

  x | The x coordinate of the linear velocity vector.
  y | The y coordinate of the linear velocity vector.
  z | The z coordinate of the linear velocity vector.

void gameplay::PhysicsRigidBody::setRestitution | ( | float | restitution | ) | `[inline]`

Sets the rigid body's restitution (or bounciness).

Parameters:

  restitution | The restitution.

All Classes Functions Variables Typedefs Enumerations Enumerator