Public Member Functions | Protected Attributes | Friends

sp::scene::CharacterController Class Reference
[Collision System]

#include <spCharacterController.hpp>

Inheritance diagram for sp::scene::CharacterController:
sp::scene::BaseCollisionPhysicsObject sp::BaseObject

List of all members.

Public Member Functions

 CharacterController (CollisionMaterial *Material, SceneNode *Node, f32 Radius, f32 Height)
virtual ~CharacterController ()
virtual void update ()
virtual void move (const dim::vector3df &Direction)
virtual void jump (f32 Force)
void setRadius (f32 Radius)
void setHeight (f32 Height)
void setMaxStepHeight (f32 MaxHeight)
CollisionCapsulegetCollisionModel ()
 Returns a pointer to the character's collision model (capsule).
const CollisionCapsulegetCollisionModel () const
 Returns a constant pointer to the character's collision model (capsule).
CollisionCapsulegetStepDetector ()
 Returns a pointer to the character's step detector.
const CollisionCapsulegetStepDetector () const
void setViewRotation (f32 Rotation)
f32 getViewRotation () const
 Returns the character's view rotation. By default 0.0.
f32 getMaxStepHeight () const
bool stayOnGround () const
 Returns true if the character is on the ground.
void setOrientation (const dim::matrix3f &Orientation)
 Sets the new character's orientation. This specifies in which direction the character will jump and move.
dim::matrix3f getOrientation () const
 Returns the orientation. By default the identity 3x3 matrix.
void setContactCallback (const CharacterContactCallback &Callback)
 Sets the collision contact callback function. Use this to determine when a collision has been detected.
CharacterContactCallback getContactCallback () const
f32 getMoveSpeed () const
void move (f32 LeftRight, f32 ForwardsBackwards)
 Simplification of the main "move" function.
void moveLeft (f32 Speed)
 Simplification of the main "move" function.
void moveRight (f32 Speed)
 Simplification of the main "move" function.
void moveForwards (f32 Speed)
 Simplification of the main "move" function.
void moveBackwards (f32 Speed)
 Simplification of the main "move" function.
dim::vector3df getMovement () const
 Returns the actual movement which is the position change from the previous to the current physics integration.

Protected Attributes

f32 ViewRotation_
f32 MaxStepHeight_
dim::matrix3f Orientation_
dim::vector3df PrevPos_
dim::vector3df CurPos_

Friends

bool ChCtrlCollisionMaterial (CollisionMaterial *Material, CollisionNode *Node, const CollisionNode *Rival, const SCollisionContact &Contact)

Detailed Description

The CharacterController class is to be used - as the name implies - to control a character in your game. Although the engine's collision sytem foundation does not support any kind of physics simulation, this character controller holds a gravity vector and a mass value. This is used to compute a 'physics-simulation like' jump action.


Constructor & Destructor Documentation

sp::scene::CharacterController::CharacterController ( CollisionMaterial Material,
SceneNode Node,
f32  Radius,
f32  Height 
)
sp::scene::CharacterController::~CharacterController (  )  [virtual]

Member Function Documentation

CollisionCapsule* sp::scene::CharacterController::getCollisionModel (  )  [inline]

Returns a pointer to the character's collision model (capsule).

const CollisionCapsule* sp::scene::CharacterController::getCollisionModel (  )  const [inline]

Returns a constant pointer to the character's collision model (capsule).

CharacterContactCallback sp::scene::CharacterController::getContactCallback (  )  const [inline]
f32 sp::scene::CharacterController::getMaxStepHeight (  )  const [inline]

Returns the maximal step height. By default the initial radius.

See also:
setMaxStepHeight
dim::vector3df sp::scene::CharacterController::getMovement (  )  const [inline]

Returns the actual movement which is the position change from the previous to the current physics integration.

f32 sp::scene::CharacterController::getMoveSpeed (  )  const [inline]

Returns the current movement speed. This is just the length of the current velocity vector, i.e. the result is equivalent to the following code:

        getVelocity().getLength()
dim::matrix3f sp::scene::CharacterController::getOrientation (  )  const [inline]

Returns the orientation. By default the identity 3x3 matrix.

CollisionCapsule* sp::scene::CharacterController::getStepDetector (  )  [inline]

Returns a pointer to the character's step detector.

const CollisionCapsule* sp::scene::CharacterController::getStepDetector (  )  const [inline]

Returns a constant pointer to the character's step detector. This can not be modified and is used internally to detect when the character needs to take a stair-case step.

f32 sp::scene::CharacterController::getViewRotation (  )  const [inline]

Returns the character's view rotation. By default 0.0.

void sp::scene::CharacterController::jump ( f32  Force  )  [virtual]

Adds the specified force to the character object.

Parameters:
Force,: Specifies the force which will be added to the upper vector. This is equivalent to the following code:

        CharCtrl->addForce(CharCtrl->getOrientation() * dim::vector3df(0, Force, 0));
void sp::scene::CharacterController::move ( f32  LeftRight,
f32  ForwardsBackwards 
) [inline]

Simplification of the main "move" function.

void sp::scene::CharacterController::move ( const dim::vector3df Direction  )  [virtual]

Adds the specified direction as a move force to the character object. The maximal move speed will not be overtraversed.

Parameters:
[in] Direction Specifies the movement direction
void sp::scene::CharacterController::moveBackwards ( f32  Speed  )  [inline]

Simplification of the main "move" function.

void sp::scene::CharacterController::moveForwards ( f32  Speed  )  [inline]

Simplification of the main "move" function.

void sp::scene::CharacterController::moveLeft ( f32  Speed  )  [inline]

Simplification of the main "move" function.

void sp::scene::CharacterController::moveRight ( f32  Speed  )  [inline]

Simplification of the main "move" function.

void sp::scene::CharacterController::setContactCallback ( const CharacterContactCallback Callback  )  [inline]

Sets the collision contact callback function. Use this to determine when a collision has been detected.

void sp::scene::CharacterController::setHeight ( f32  Height  ) 
void sp::scene::CharacterController::setMaxStepHeight ( f32  MaxHeight  ) 
void sp::scene::CharacterController::setOrientation ( const dim::matrix3f Orientation  )  [inline]

Sets the new character's orientation. This specifies in which direction the character will jump and move.

void sp::scene::CharacterController::setRadius ( f32  Radius  ) 
void sp::scene::CharacterController::setViewRotation ( f32  Rotation  )  [inline]

Sets the character's view rotation. This is used for further movement.

See also:
move
bool sp::scene::CharacterController::stayOnGround (  )  const [inline]

Returns true if the character is on the ground.

void sp::scene::CharacterController::update (  )  [virtual]

Updates the character controller behaviour. This includes: gravity appliance.


Friends And Related Function Documentation

bool ChCtrlCollisionMaterial ( CollisionMaterial Material,
CollisionNode Node,
const CollisionNode Rival,
const SCollisionContact Contact 
) [friend]

Member Data Documentation


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines