CrystalSpace

Public API Reference

Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

csColliderActor Class Reference

With csColliderActor you can more easily manage collision detection of a player or character model with gravity handling. More...

#include <cstool/collider.h>

List of all members.

Public Member Functions

bool AdjustForCollisions (const csVector3 &oldpos, csVector3 &newpos, const csVector3 &vel, float delta)
 This is used by Move() but you can also call it manually.
bool CheckRevertMove () const
 Check if we should revert a move (revert rotation).
 csColliderActor ()
 Construct.
float GetGravity () const
 Get gravity.
const csVector3GetRotation ()
 Get current rotation in angles around every axis.
bool HasCD () const
 Return true if collision detection is enabled.
void InitializeColliders (iCamera *camera, const csVector3 &legs, const csVector3 &body, const csVector3 &shift)
 Initialize the colliders.
void InitializeColliders (iMeshWrapper *mesh, const csVector3 &legs, const csVector3 &body, const csVector3 &shift)
 Initialize the colliders.
bool IsOnGround () const
 Check if we are on the ground.
bool Move (float delta, float speed, const csVector3 &velBody, const csVector3 &angularVelocity)
 Move the model.
void SetCD (bool c)
 Enable/disable collision detection (default enabled).
void SetCollideSystem (iCollideSystem *cdsys)
 Set the collision detection system.
void SetEngine (iEngine *engine)
 Set the engine.
void SetGravity (float g)
 Set gravity.
void SetOnGround (bool og)
 Set the onground status.
void SetRotation (const csVector3 &rot)
 Set current rotation.


Detailed Description

With csColliderActor you can more easily manage collision detection of a player or character model with gravity handling.

Definition at line 329 of file collider.h.


Constructor & Destructor Documentation

csColliderActor::csColliderActor  ) 
 

Construct.


Member Function Documentation

bool csColliderActor::AdjustForCollisions const csVector3 oldpos,
csVector3 newpos,
const csVector3 vel,
float  delta
 

This is used by Move() but you can also call it manually.

It will adjust the new position to match with collision detection.

bool csColliderActor::CheckRevertMove  )  const [inline]
 

Check if we should revert a move (revert rotation).

Definition at line 496 of file collider.h.

float csColliderActor::GetGravity  )  const [inline]
 

Get gravity.

Definition at line 471 of file collider.h.

const csVector3& csColliderActor::GetRotation  )  [inline]
 

Get current rotation in angles around every axis.

This is only used if a camera is used.

Definition at line 516 of file collider.h.

bool csColliderActor::HasCD  )  const [inline]
 

Return true if collision detection is enabled.

Definition at line 486 of file collider.h.

void csColliderActor::InitializeColliders iCamera camera,
const csVector3 legs,
const csVector3 body,
const csVector3 shift
 

Initialize the colliders.

This version is used if you have a first person view and want collision detection to move the camera instead of a mesh.

Parameters:
camera is the camera.
legs is the size of the leg collider.
body is the size of the body collider.
shift is a shift added to the colliders. Normally the origin is assumed to be at the bottom of the model. With this shift you can adjust that.

void csColliderActor::InitializeColliders iMeshWrapper mesh,
const csVector3 legs,
const csVector3 body,
const csVector3 shift
 

Initialize the colliders.

Parameters:
mesh is the mesh.
legs is the size of the leg collider.
body is the size of the body collider.
shift is a shift added to the colliders. Normally the origin is assumed to be at the bottom of the model. With this shift you can adjust that.

bool csColliderActor::IsOnGround  )  const [inline]
 

Check if we are on the ground.

Definition at line 476 of file collider.h.

bool csColliderActor::Move float  delta,
float  speed,
const csVector3 velBody,
const csVector3 angularVelocity
 

Move the model.

Parameters:
delta is the number of seconds (floating point) elapsed time. Typically this is the elapsed time from the virtual clock divided by 1000.0f.
speed is the desired movement speed. This can be 1.0f for default speed.
velBody is the relative movement vector in object space of the model (i.e. 0,0,1 will move the model forward).
angularVelocity is the velocity of rotation.

void csColliderActor::SetCD bool  c  )  [inline]
 

Enable/disable collision detection (default enabled).

Definition at line 491 of file collider.h.

void csColliderActor::SetCollideSystem iCollideSystem cdsys  )  [inline]
 

Set the collision detection system.

Definition at line 422 of file collider.h.

void csColliderActor::SetEngine iEngine engine  )  [inline]
 

Set the engine.

Definition at line 428 of file collider.h.

void csColliderActor::SetGravity float  g  )  [inline]
 

Set gravity.

Default 9.806.

Definition at line 462 of file collider.h.

void csColliderActor::SetOnGround bool  og  )  [inline]
 

Set the onground status.

Definition at line 481 of file collider.h.

void csColliderActor::SetRotation const csVector3 rot  ) 
 

Set current rotation.

This is only used if a camera is used.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.4.4