overview wiki api reference download
 All Classes Functions Variables Typedefs Enumerations Enumerator
Classes | Public Member Functions | Protected Member Functions
gameplay::PhysicsCharacter Class Reference

#include <PhysicsCharacter.h>

Inheritance diagram for gameplay::PhysicsCharacter:
gameplay::PhysicsGhostObject gameplay::PhysicsCollisionObject gameplay::Transform::Listener

List of all members.

Classes

class  ActionInterface

Public Member Functions

PhysicsCollisionObject::Type getType () const
bool isPhysicsEnabled () const
void setPhysicsEnabled (bool enabled)
float getMaxStepHeight () const
void setMaxStepHeight (float height)
float getMaxSlopeAngle () const
void setMaxSlopeAngle (float angle)
void setVelocity (const Vector3 &velocity)
void setVelocity (float x, float y, float z)
void resetVelocityState ()
void rotate (const Vector3 &axis, float angle)
void rotate (const Quaternion &rotation)
void setRotation (const Vector3 &axis, float angle)
void setRotation (const Quaternion &rotation)
void setForwardVelocity (float velocity=1.0f)
void setRightVelocity (float velocity=1.0f)
Vector3 getCurrentVelocity () const
void jump (float height, bool force=false)

Protected Member Functions

btCollisionObject * getCollisionObject () const

Detailed Description

Defines a physics controller class for a game character.

This can be used to control the movements and collisions of a character in a game. It interacts with the Physics system to apply gravity and handle collisions, however dynamics are not applied to the character directly by the physics system. Instead, the character's movement is controlled directly by the PhysicsCharacter class. This results in a more responsive and typical game character than would be possible if trying to move a character by applying physical simulation with forces.

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

Member Function Documentation

btCollisionObject* gameplay::PhysicsCharacter::getCollisionObject ( ) const [protected, virtual]

Returns the current velocity of the character.

Returns:
The current velocity.

Returns the maximum slope angle for the character.

The maximum slope angle determines the maximum angle of terrain that the character can walk on. Slopes with an angle larger than the specified angle will not allow the character to move on.

Returns:
The maximum slope angle.

Returns the maximum step height for the character.

Returns:
The maximum step height.

Returns whether physics simulation is enabled for the physics character.

Returns:
true if physics simulation is enabled, false otherwise.
See also:
setPhysicsEnabled(bool)
void gameplay::PhysicsCharacter::jump ( float  height,
bool  force = false 
)

Causes the character to jump to the specified height.

Parameters:
heightThe amount to jump.
forceSet true to force the character to jump even if vertical velocity is non-zero

Resets the internal velocity state which brings the character to an immediate stop

void gameplay::PhysicsCharacter::rotate ( const Vector3 axis,
float  angle 
)

Rotates the character.

Parameters:
axisAxis of rotation.
angleAngle in radians.
void gameplay::PhysicsCharacter::rotate ( const Quaternion rotation)

Rotates the character.

Parameters:
rotationQuaternion representing the rotation to apply.
void gameplay::PhysicsCharacter::setForwardVelocity ( float  velocity = 1.0f)

Moves the character forward with the given velocity vector.

The forward velocity is defined by the character's current orientation (it is the forward vector from the character's current world transform).

Note that a negative velocity (i.e. -1.0f) will move the character backwards.

Parameters:
velocityOptional velocity modifier.

Sets the maximum slope angle (in degrees).

Parameters:
angleThe maximum slope angle.

Sets the maximum step height for the character.

Parameters:
heightThe maximum step height.

Enables or disables physics simulation for the character.

When physics simulation is enabled (default), the physics character automatically responds to collisions in the physics world. For example, the character will automatically slide along walls, step up stairs, react to gravity, etc.

When disabled, the character will not have any physics applied on it and will therefore be allowed to walk through walls, ceiling, floors, other objects, etc.

Parameters:
enabledtrue to enable physics simulation, false otherwise.
void gameplay::PhysicsCharacter::setRightVelocity ( float  velocity = 1.0f)

Moves the character right with the given velocity vector.

The right velocity is defined by the character's current orientation (it is the right vector from the character's current world transform).

Note that a negative velocity (i.e. -1.0f) will move the character left.

Parameters:
velocityOptional velocity modifier.
void gameplay::PhysicsCharacter::setRotation ( const Vector3 axis,
float  angle 
)

Sets the rotation of the character.

Parameters:
axisAxis of rotation.
angleAngle in radians.

Sets the rotation of the character.

Parameters:
rotationQuaternion representing the new rotation.

Sets the velocity of the character.

Calling this function sets the velocity (speed and direction) for the character. The velocity is maintained until this method is called again. The final velocity of the character is determined by product of the current velocity, right and forward vectors.

Parameters:
velocityMovement velocity.
void gameplay::PhysicsCharacter::setVelocity ( float  x,
float  y,
float  z 
)

Sets the velocity of the character.

Calling this function sets the velocity (speed and direction) for the character. The velocity is maintained until this method is called again. The final velocity of the character is determined by product of the current velocity, right and forward vectors.

Parameters:
xThe x coordinate of the velocity vector.
yThe y coordinate of the velocity vector.
zThe z coordinate of the velocity vector.
 All Classes Functions Variables Typedefs Enumerations Enumerator