#include <fpscollider.h>
Public Types | ||||
| enum | eMode { WALKING = 0, FALLING, SLIDING } | |||
Public Member Functions | ||||
| FPSCollider (float pHeight, float pRadius, float k, float theta, dtCore::Scene *pScene) | ||||
| Constructor. | ||||
| FPSCollider (float pHeight, float pRadius, float k, float theta, dSpaceID pSpaceToCollideWith, const osg::Vec3 &pGravity) | ||||
| virtual | ~FPSCollider () | |||
| osg::Vec3 | Update (const osg::Vec3 &p0, const osg::Vec3 &v0, float deltaFrameTime, bool pJump) | |||
| ||||
| dSpaceID | GetSpaceID () const | |||
| ||||
| eMode | GetMode () const | |||
| ||||
| float | GetSlideThreshold () const | |||
| void | SetSlideThreshold (float pSlide) | |||
| float | GetSlideSpeed () const | |||
| ||||
| void | SetSlideSpeed (float pSpeed) | |||
| float | GetJumpSpeed () const | |||
| Jump speed is the force we apply to our body when jumping in meters per second. | ||||
| void | SetJumpSpeed (float pSpeed) | |||
| float | GetHeightAboveTerrain () const | |||
| ||||
| void | SetDimensions (float pHeight, float pRadius, float k, float theta) | |||
| ||||
-We currently only support collision meshes -There is a maximum slope that we can go up (SlideThreshold), when on a poly with normal dotted with Up (0,0,1) < SlideThreshold we begin sliding, the user has no control until sliding is resolved and we are on a "good" poly again -Because user has no control during Sliding we can get stuck where two polys come together where each one is too steep to climb up, typical ravine like so \/ -Also when sliding we will continue sliding even if our momentum should carry us over the edge of a cliff
| dtCore::FPSCollider::FPSCollider | ( | float | pHeight, | |
| float | pRadius, | |||
| float | k, | |||
| float | theta, | |||
| dtCore::Scene * | pScene | |||
| ) |
Constructor.
| height,the | height of the character and camera, in meters | |
| radius,the | width of our character | |
| k | the distance from the bottom of the knees to the ground, this represents the maximum step up height | |
| theta | the collision amount to maintain below the ground (note: this should be less then half of k, something small like 0.1 is recommended) | |
| Scene | is used to get the gravity and the ode space |
| dtCore::FPSCollider::FPSCollider | ( | float | pHeight, | |
| float | pRadius, | |||
| float | k, | |||
| float | theta, | |||
| dSpaceID | pSpaceToCollideWith, | |||
| const osg::Vec3 & | pGravity | |||
| ) |
| dtCore::FPSCollider::~FPSCollider | ( | ) | [virtual] |
| osg::Vec3 dtCore::FPSCollider::Update | ( | const osg::Vec3 & | p0, | |
| const osg::Vec3 & | v0, | |||
| float | deltaFrameTime, | |||
| bool | pJump | |||
| ) |
| p0 | is the current position of the camera which is our position plus our height above the ground |
| v0 | is our instantaneous velocity, or the direction we want to go as a note the last velocity is saved for adjusting falling speed so if you want to warp you may need to set velocity to 0 for one frame | |
| deltaFrameTime | is the elapsed time in seconds since the last frame | |
| pJump | specifies whether or not we want to jump |
| dSpaceID dtCore::FPSCollider::GetSpaceID | ( | ) | const |
| FPSCollider::eMode dtCore::FPSCollider::GetMode | ( | ) | const |
| float dtCore::FPSCollider::GetSlideThreshold | ( | ) | const |
| void dtCore::FPSCollider::SetSlideThreshold | ( | float | pSlide | ) |
| float dtCore::FPSCollider::GetSlideSpeed | ( | ) | const |
| void dtCore::FPSCollider::SetSlideSpeed | ( | float | pSpeed | ) |
| float dtCore::FPSCollider::GetJumpSpeed | ( | ) | const |
Jump speed is the force we apply to our body when jumping in meters per second.
| void dtCore::FPSCollider::SetJumpSpeed | ( | float | pSpeed | ) |
| float dtCore::FPSCollider::GetHeightAboveTerrain | ( | ) | const |
| void dtCore::FPSCollider::SetDimensions | ( | float | pHeight, | |
| float | pRadius, | |||
| float | k, | |||
| float | theta | |||
| ) |
| pHeight | is the height of our camera and the top of our bv |
| pRadius | is the width of our character | |
| k | is the max distance we can step up and the size of our feet bv | |
| theta | is the distance we maintain below the surface (should be less then half of k) |