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>
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 | CheckHitMeshes () const |
Return true if we remember the meshes we hit. | |
bool | CheckRevertMove () const |
Check if we should revert a move (revert rotation). | |
csColliderActor () | |
Construct. | |
void | EnableHitMeshes (bool hm) |
Enable remembering of the meshes we hit. | |
float | GetGravity () const |
Get gravity. | |
const csSet< csPtrKey< iMeshWrapper > > & | GetHitMeshes () |
Return the meshes that we hit in the last call to Move(). | |
const csVector3 & | GetRotation () |
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 | SetCamera (iCamera *camera, bool adjustRotation=true) |
Change the current camera. | |
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 334 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::CheckHitMeshes | ( | ) | const [inline] |
bool csColliderActor::CheckRevertMove | ( | ) | const [inline] |
void csColliderActor::EnableHitMeshes | ( | bool | hm | ) | [inline] |
Enable remembering of the meshes we hit.
By default this is disabled. If this is enabled you can call GetHitMeshes() after calling Move() to get a set of all meshes that were hit.
Definition at line 499 of file collider.h.
float csColliderActor::GetGravity | ( | ) | const [inline] |
const csSet<csPtrKey<iMeshWrapper> >& csColliderActor::GetHitMeshes | ( | ) | [inline] |
Return the meshes that we hit in the last call to Move().
Calling Move() again will clear this set and calculate it again. This works only if EnableHitMeshes(true) is called.
Definition at line 509 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 531 of file collider.h.
bool csColliderActor::HasCD | ( | ) | const [inline] |
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] |
bool csColliderActor::Move | ( | float | delta, | |
float | speed, | |||
const csVector3 & | velBody, | |||
const csVector3 & | angularVelocity | |||
) |
Move the model.
If EnableHitMeshes(true) is set then you can use GetHitMeshes() after this to detect the meshes that were hit.
- 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::SetCamera | ( | iCamera * | camera, | |
bool | adjustRotation = true | |||
) |
Change the current camera.
- Parameters:
-
camera New current camera adjustRotation Whether to retrieve the current rotation from the camera.
void csColliderActor::SetCD | ( | bool | c | ) | [inline] |
void csColliderActor::SetCollideSystem | ( | iCollideSystem * | cdsys | ) | [inline] |
void csColliderActor::SetEngine | ( | iEngine * | engine | ) | [inline] |
void csColliderActor::SetGravity | ( | float | g | ) | [inline] |
void csColliderActor::SetOnGround | ( | bool | og | ) | [inline] |
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:
- cstool/collider.h
Generated for Crystal Space by doxygen 1.4.7