overview wiki api reference download
 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:
gameplay::PhysicsCollisionObject gameplay::Transform::Listener

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:
forceThe force to be applied.
relativePositionThe 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:
impulseThe force impulse to be applied.
relativePositionThe relative position from which to apply the force.

Applies the given torque to the rigid body.

Parameters:
torqueThe torque to be applied.

Applies the given torque impulse to the rigid body.

Parameters:
torqueThe torque impulse to be applied.

Gets the rigid body's angular damping.

Returns:
The angular damping.

Gets the rigid body's angular factor.

Returns:
The angular factor.

Gets the rigid body's angular velocity.

Returns:
The angular velocity.

Gets the rigid body's anisotropic friction.

Returns:
The anisotropic friction.
btCollisionObject* gameplay::PhysicsRigidBody::getCollisionObject ( ) const [protected, virtual]
float gameplay::PhysicsRigidBody::getFriction ( ) const [inline]

Gets the rigid body's friction.

Returns:
The friction.

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:
xThe x position, in world space.
zThe z position, in world space.
Returns:
The height at the given point, or zero if this is not a heightfield rigid body.

Gets the rigid body's linear damping.

Returns:
The linear damping.

Gets the rigid body's linear factor.

Returns:
The linear factor.

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.

Gets the rigid body's restitution.

Returns:
The restitution.

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:
angularFactorangular 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:
xThe x coordinate of the angular factor vector.
yThe y coordinate of the angular factor vector.
zThe z coordinate of the angular factor vector.
void gameplay::PhysicsRigidBody::setAngularVelocity ( const Vector3 velocity) [inline]

Sets the rigid body's angular velocity.

Parameters:
velocityThe angular velocity.
void gameplay::PhysicsRigidBody::setAngularVelocity ( float  x,
float  y,
float  z 
) [inline]

Sets the rigid body's angular velocity.

Parameters:
xThe x coordinate of the angular velocity vector.
yThe y coordinate of the angular velocity vector.
zThe z coordinate of the angular velocity vector.
void gameplay::PhysicsRigidBody::setAnisotropicFriction ( const Vector3 friction) [inline]

Sets the rigid body's anisotropic friction.

Parameters:
frictionThe anisotropic friction.
void gameplay::PhysicsRigidBody::setAnisotropicFriction ( float  x,
float  y,
float  z 
) [inline]

Sets the rigid body's anisotropic friction.

Parameters:
xThe x coordinate of the anisotropic friction.
yThe y coordinate of the anisotropic friction.
zThe 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:
linearDampingThe linear damping; between 0.0 (minimum) and 1.0 (maximum).
angularDampingThe angular damping; between 0.0 (minimum) and 1.0 (maximum).

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

Parameters:
enabletrue 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:
frictionThe 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:
gravityThe 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:
xThe x coordinate of the gravity vector.
yThe y coordinate of the gravity vector.
zThe 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:
kinematicWhether 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:
linearFactorlinear 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:
xThe x coordinate of the linear factor vector.
yThe y coordinate of the linear factor vector.
zThe z coordinate of the linear factor vector.
void gameplay::PhysicsRigidBody::setLinearVelocity ( const Vector3 velocity) [inline]

Sets the rigid body's linear velocity.

Parameters:
velocityThe linear velocity.
void gameplay::PhysicsRigidBody::setLinearVelocity ( float  x,
float  y,
float  z 
) [inline]

Sets the rigid body's linear velocity.

Parameters:
xThe x coordinate of the linear velocity vector.
yThe y coordinate of the linear velocity vector.
zThe z coordinate of the linear velocity vector.
void gameplay::PhysicsRigidBody::setRestitution ( float  restitution) [inline]

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

Parameters:
restitutionThe restitution.
 All Classes Functions Variables Typedefs Enumerations Enumerator