Blender V2.61 - r43446
|
#include <btKinematicCharacterController.h>
btKinematicCharacterController is an object that supports a sliding motion in a world. It uses a ghost object and convex sweep test to test for upcoming collisions. This is combined with discrete collision detection to recover from penetrations. Interaction between btKinematicCharacterController and dynamic rigid bodies needs to be explicity implemented by the user.
Definition at line 36 of file btKinematicCharacterController.h.
btKinematicCharacterController::btKinematicCharacterController | ( | btPairCachingGhostObject * | ghostObject, |
btConvexShape * | convexShape, | ||
btScalar | stepHeight, | ||
int | upAxis = 1 |
||
) |
Definition at line 130 of file btKinematicCharacterController.cpp.
References btRadians(), m_addedMargin, m_convexShape, m_fallSpeed, m_ghostObject, m_gravity, m_jumpSpeed, m_stepHeight, m_turnAngle, m_upAxis, m_useGhostObjectSweepTest, m_useWalkDirection, m_velocityTimeInterval, m_verticalOffset, m_verticalVelocity, m_walkDirection, m_wasJumping, m_wasOnGround, and setMaxSlope().
btKinematicCharacterController::~btKinematicCharacterController | ( | ) |
Definition at line 152 of file btKinematicCharacterController.cpp.
bool btKinematicCharacterController::canJump | ( | ) | const [virtual] |
Implements btCharacterControllerInterface.
Definition at line 581 of file btKinematicCharacterController.cpp.
References onGround().
Referenced by jump().
btVector3 btKinematicCharacterController::computeReflectionDirection | ( | const btVector3 & | direction, |
const btVector3 & | normal | ||
) | [protected] |
Definition at line 108 of file btKinematicCharacterController.cpp.
Referenced by updateTargetPositionBasedOnCollision().
void btKinematicCharacterController::debugDraw | ( | btIDebugDraw * | debugDrawer | ) | [virtual] |
btActionInterface interface
Implements btActionInterface.
Definition at line 639 of file btKinematicCharacterController.cpp.
btPairCachingGhostObject * btKinematicCharacterController::getGhostObject | ( | ) |
Definition at line 156 of file btKinematicCharacterController.cpp.
References m_ghostObject.
Referenced by stepDown(), stepForwardAndStrafe(), and stepUp().
btScalar btKinematicCharacterController::getGravity | ( | ) | const |
Definition at line 610 of file btKinematicCharacterController.cpp.
References m_gravity.
btScalar btKinematicCharacterController::getMaxSlope | ( | ) | const |
Definition at line 621 of file btKinematicCharacterController.cpp.
References m_maxSlopeRadians.
btVector3 * btKinematicCharacterController::getUpAxisDirections | ( | ) | [static, protected] |
Definition at line 632 of file btKinematicCharacterController.cpp.
Referenced by stepDown(), and stepUp().
void btKinematicCharacterController::jump | ( | ) | [virtual] |
Implements btCharacterControllerInterface.
Definition at line 586 of file btKinematicCharacterController.cpp.
References canJump(), btTransform::getBasis(), m_jumpSpeed, m_verticalVelocity, and m_wasJumping.
bool btKinematicCharacterController::onGround | ( | ) | const [virtual] |
Implements btCharacterControllerInterface.
Definition at line 626 of file btKinematicCharacterController.cpp.
References m_verticalOffset, and m_verticalVelocity.
Referenced by canJump(), and playerStep().
btVector3 btKinematicCharacterController::parallelComponent | ( | const btVector3 & | direction, |
const btVector3 & | normal | ||
) | [protected] |
Definition at line 116 of file btKinematicCharacterController.cpp.
Referenced by perpindicularComponent(), and updateTargetPositionBasedOnCollision().
btVector3 btKinematicCharacterController::perpindicularComponent | ( | const btVector3 & | direction, |
const btVector3 & | normal | ||
) | [protected] |
Definition at line 125 of file btKinematicCharacterController.cpp.
References parallelComponent().
Referenced by updateTargetPositionBasedOnCollision().
void btKinematicCharacterController::playerStep | ( | btCollisionWorld * | collisionWorld, |
btScalar | dt | ||
) | [virtual] |
Implements btCharacterControllerInterface.
Definition at line 508 of file btKinematicCharacterController.cpp.
References btFabs(), m_currentPosition, m_fallSpeed, m_ghostObject, m_gravity, m_jumpSpeed, m_useWalkDirection, m_velocityTimeInterval, m_verticalOffset, m_verticalVelocity, m_walkDirection, m_wasOnGround, onGround(), btTransform::setOrigin(), stepDown(), stepForwardAndStrafe(), and stepUp().
Referenced by updateAction().
void btKinematicCharacterController::preStep | ( | btCollisionWorld * | collisionWorld | ) | [virtual] |
Implements btCharacterControllerInterface.
Definition at line 483 of file btKinematicCharacterController.cpp.
References m_currentPosition, m_ghostObject, m_targetPosition, m_touchingContact, and recoverFromPenetration().
Referenced by updateAction().
bool btKinematicCharacterController::recoverFromPenetration | ( | btCollisionWorld * | collisionWorld | ) | [protected] |
Definition at line 161 of file btKinematicCharacterController.cpp.
References btDispatcher::dispatchAllCollisionPairs(), btCollisionWorld::getDispatcher(), btCollisionWorld::getDispatchInfo(), btManifoldPoint::getDistance(), btHashedOverlappingPairCache::getNumOverlappingPairs(), btHashedOverlappingPairCache::getOverlappingPairArray(), btPairCachingGhostObject::getOverlappingPairCache(), i, m_currentPosition, m_ghostObject, m_manifoldArray, btManifoldPoint::m_normalWorldOnB, m_touchingNormal, p, btAlignedObjectArray< T >::resize(), btTransform::setOrigin(), and btAlignedObjectArray< T >::size().
Referenced by preStep().
void btKinematicCharacterController::reset | ( | ) | [virtual] |
Implements btCharacterControllerInterface.
Definition at line 470 of file btKinematicCharacterController.cpp.
void btKinematicCharacterController::setFallSpeed | ( | btScalar | fallSpeed | ) |
Definition at line 566 of file btKinematicCharacterController.cpp.
References m_fallSpeed.
void btKinematicCharacterController::setGravity | ( | btScalar | gravity | ) |
Definition at line 605 of file btKinematicCharacterController.cpp.
References m_gravity.
void btKinematicCharacterController::setJumpSpeed | ( | btScalar | jumpSpeed | ) |
Definition at line 571 of file btKinematicCharacterController.cpp.
References m_jumpSpeed.
void btKinematicCharacterController::setMaxJumpHeight | ( | btScalar | maxJumpHeight | ) |
Definition at line 576 of file btKinematicCharacterController.cpp.
References m_maxJumpHeight.
void btKinematicCharacterController::setMaxSlope | ( | btScalar | slopeRadians | ) |
The max slope determines the maximum angle that the controller can walk up. The slope angle is measured in radians.
Definition at line 615 of file btKinematicCharacterController.cpp.
References btCos(), m_maxSlopeCosine, and m_maxSlopeRadians.
Referenced by btKinematicCharacterController().
void btKinematicCharacterController::setUpAxis | ( | int | axis | ) | [inline] |
Definition at line 108 of file btKinematicCharacterController.h.
References m_upAxis.
void btKinematicCharacterController::setUseGhostSweepTest | ( | bool | useGhostObjectSweepTest | ) | [inline] |
Definition at line 154 of file btKinematicCharacterController.h.
References m_useGhostObjectSweepTest.
void btKinematicCharacterController::setVelocityForTimeInterval | ( | const btVector3 & | velocity, |
btScalar | timeInterval | ||
) | [virtual] |
Caller provides a velocity with which the character should move for the given time period. After the time period, velocity is reset to zero. This call will reset any walk direction set by setWalkDirection(). Negative time intervals will result in no motion.
Implements btCharacterControllerInterface.
Definition at line 452 of file btKinematicCharacterController.cpp.
References getNormalizedVector().
void btKinematicCharacterController::setWalkDirection | ( | const btVector3 & | walkDirection | ) | [virtual] |
This should probably be called setPositionIncrementPerSimulatorStep. This is neither a direction nor a velocity, but the amount to increment the position each simulation iteration, regardless of dt. This call will reset any velocity set by setVelocityForTimeInterval().
Implements btCharacterControllerInterface.
Definition at line 440 of file btKinematicCharacterController.cpp.
References getNormalizedVector().
void btKinematicCharacterController::stepDown | ( | btCollisionWorld * | collisionWorld, |
btScalar | dt | ||
) | [protected] |
Definition at line 384 of file btKinematicCharacterController.cpp.
References btCollisionWorld::convexSweepTest(), btCollisionWorld::getDispatchInfo(), getGhostObject(), getUpAxisDirections(), btCollisionWorld::ConvexResultCallback::hasHit(), btDispatcherInfo::m_allowedCcdPenetration, btCollisionWorld::ConvexResultCallback::m_closestHitFraction, btCollisionWorld::ConvexResultCallback::m_collisionFilterGroup, btCollisionWorld::ConvexResultCallback::m_collisionFilterMask, m_convexShape, m_currentPosition, m_currentStepOffset, m_ghostObject, m_maxSlopeCosine, m_stepHeight, m_targetPosition, m_upAxis, m_useGhostObjectSweepTest, m_verticalOffset, m_verticalVelocity, m_wasJumping, m_wasOnGround, btTransform::setIdentity(), and btTransform::setOrigin().
Referenced by playerStep().
void btKinematicCharacterController::stepForwardAndStrafe | ( | btCollisionWorld * | collisionWorld, |
const btVector3 & | walkMove | ||
) | [protected] |
Definition at line 295 of file btKinematicCharacterController.cpp.
References btCollisionWorld::convexSweepTest(), btCollisionWorld::getDispatchInfo(), getGhostObject(), btCollisionWorld::ConvexResultCallback::hasHit(), length(), m_addedMargin, btDispatcherInfo::m_allowedCcdPenetration, btCollisionWorld::ConvexResultCallback::m_closestHitFraction, btCollisionWorld::ConvexResultCallback::m_collisionFilterGroup, btCollisionWorld::ConvexResultCallback::m_collisionFilterMask, m_convexShape, m_currentPosition, m_ghostObject, btCollisionWorld::ClosestConvexResultCallback::m_hitNormalWorld, btCollisionWorld::ClosestConvexResultCallback::m_hitPointWorld, m_normalizedDirection, m_targetPosition, m_touchingContact, m_touchingNormal, m_useGhostObjectSweepTest, btTransform::setIdentity(), btTransform::setOrigin(), SIMD_EPSILON, and updateTargetPositionBasedOnCollision().
Referenced by playerStep().
void btKinematicCharacterController::stepUp | ( | btCollisionWorld * | collisionWorld | ) | [protected] |
Definition at line 216 of file btKinematicCharacterController.cpp.
References btCollisionWorld::convexSweepTest(), btCollisionWorld::getDispatchInfo(), getGhostObject(), getUpAxisDirections(), btCollisionWorld::ConvexResultCallback::hasHit(), m_addedMargin, btDispatcherInfo::m_allowedCcdPenetration, btCollisionWorld::ConvexResultCallback::m_closestHitFraction, btCollisionWorld::ConvexResultCallback::m_collisionFilterGroup, btCollisionWorld::ConvexResultCallback::m_collisionFilterMask, m_convexShape, m_currentPosition, m_currentStepOffset, m_ghostObject, btCollisionWorld::ClosestConvexResultCallback::m_hitNormalWorld, m_stepHeight, m_targetPosition, m_upAxis, m_useGhostObjectSweepTest, m_verticalOffset, m_verticalVelocity, btTransform::setIdentity(), and btTransform::setOrigin().
Referenced by playerStep().
virtual void btKinematicCharacterController::updateAction | ( | btCollisionWorld * | collisionWorld, |
btScalar | deltaTime | ||
) | [inline, virtual] |
btActionInterface interface
Implements btActionInterface.
Definition at line 99 of file btKinematicCharacterController.h.
References playerStep(), and preStep().
void btKinematicCharacterController::updateTargetPositionBasedOnCollision | ( | const btVector3 & | hit_normal, |
btScalar | tangentMag = btScalar(0.0) , |
||
btScalar | normalMag = btScalar(1.0) |
||
) | [protected] |
Definition at line 259 of file btKinematicCharacterController.cpp.
References computeReflectionDirection(), m_currentPosition, m_targetPosition, parallelComponent(), perpindicularComponent(), and SIMD_EPSILON.
Referenced by stepForwardAndStrafe().
void btKinematicCharacterController::warp | ( | const btVector3 & | origin | ) | [virtual] |
Implements btCharacterControllerInterface.
Definition at line 474 of file btKinematicCharacterController.cpp.
References m_ghostObject, btTransform::setIdentity(), and btTransform::setOrigin().
Definition at line 58 of file btKinematicCharacterController.h.
Referenced by btKinematicCharacterController(), stepForwardAndStrafe(), and stepUp().
btConvexShape* btKinematicCharacterController::m_convexShape [protected] |
Definition at line 43 of file btKinematicCharacterController.h.
Referenced by btKinematicCharacterController(), stepDown(), stepForwardAndStrafe(), and stepUp().
btVector3 btKinematicCharacterController::m_currentPosition [protected] |
Definition at line 65 of file btKinematicCharacterController.h.
Referenced by playerStep(), preStep(), recoverFromPenetration(), stepDown(), stepForwardAndStrafe(), stepUp(), and updateTargetPositionBasedOnCollision().
Definition at line 66 of file btKinematicCharacterController.h.
Referenced by stepDown(), and stepUp().
btScalar btKinematicCharacterController::m_fallSpeed [protected] |
Definition at line 47 of file btKinematicCharacterController.h.
Referenced by btKinematicCharacterController(), playerStep(), and setFallSpeed().
Definition at line 42 of file btKinematicCharacterController.h.
Referenced by btKinematicCharacterController(), getGhostObject(), playerStep(), preStep(), recoverFromPenetration(), stepDown(), stepForwardAndStrafe(), stepUp(), and warp().
btScalar btKinematicCharacterController::m_gravity [protected] |
Definition at line 52 of file btKinematicCharacterController.h.
Referenced by btKinematicCharacterController(), getGravity(), playerStep(), and setGravity().
btScalar btKinematicCharacterController::m_halfHeight [protected] |
Definition at line 40 of file btKinematicCharacterController.h.
btScalar btKinematicCharacterController::m_jumpSpeed [protected] |
Definition at line 48 of file btKinematicCharacterController.h.
Referenced by btKinematicCharacterController(), jump(), playerStep(), and setJumpSpeed().
keep track of the contact manifolds
Definition at line 70 of file btKinematicCharacterController.h.
Referenced by recoverFromPenetration().
Definition at line 49 of file btKinematicCharacterController.h.
Referenced by setMaxJumpHeight().
Definition at line 51 of file btKinematicCharacterController.h.
Referenced by setMaxSlope(), and stepDown().
Definition at line 50 of file btKinematicCharacterController.h.
Referenced by getMaxSlope(), and setMaxSlope().
btVector3 btKinematicCharacterController::m_normalizedDirection [protected] |
Definition at line 62 of file btKinematicCharacterController.h.
Referenced by stepForwardAndStrafe().
btScalar btKinematicCharacterController::m_stepHeight [protected] |
Definition at line 56 of file btKinematicCharacterController.h.
Referenced by btKinematicCharacterController(), stepDown(), and stepUp().
btVector3 btKinematicCharacterController::m_targetPosition [protected] |
Definition at line 67 of file btKinematicCharacterController.h.
Referenced by preStep(), stepDown(), stepForwardAndStrafe(), stepUp(), and updateTargetPositionBasedOnCollision().
bool btKinematicCharacterController::m_touchingContact [protected] |
Definition at line 72 of file btKinematicCharacterController.h.
Referenced by preStep(), and stepForwardAndStrafe().
btVector3 btKinematicCharacterController::m_touchingNormal [protected] |
Definition at line 73 of file btKinematicCharacterController.h.
Referenced by recoverFromPenetration(), and stepForwardAndStrafe().
btScalar btKinematicCharacterController::m_turnAngle [protected] |
Definition at line 54 of file btKinematicCharacterController.h.
Referenced by btKinematicCharacterController().
int btKinematicCharacterController::m_upAxis [protected] |
Definition at line 80 of file btKinematicCharacterController.h.
Referenced by btKinematicCharacterController(), setUpAxis(), stepDown(), and stepUp().
bool btKinematicCharacterController::m_useGhostObjectSweepTest [protected] |
Definition at line 77 of file btKinematicCharacterController.h.
Referenced by btKinematicCharacterController(), setUseGhostSweepTest(), stepDown(), stepForwardAndStrafe(), and stepUp().
bool btKinematicCharacterController::m_useWalkDirection [protected] |
Definition at line 78 of file btKinematicCharacterController.h.
Referenced by btKinematicCharacterController(), and playerStep().
Definition at line 79 of file btKinematicCharacterController.h.
Referenced by btKinematicCharacterController(), and playerStep().
Definition at line 46 of file btKinematicCharacterController.h.
Referenced by btKinematicCharacterController(), onGround(), playerStep(), stepDown(), and stepUp().
Definition at line 45 of file btKinematicCharacterController.h.
Referenced by btKinematicCharacterController(), jump(), onGround(), playerStep(), stepDown(), and stepUp().
btVector3 btKinematicCharacterController::m_walkDirection [protected] |
this is the desired walk direction, set by the user
Definition at line 61 of file btKinematicCharacterController.h.
Referenced by btKinematicCharacterController(), and playerStep().
bool btKinematicCharacterController::m_wasJumping [protected] |
Definition at line 76 of file btKinematicCharacterController.h.
Referenced by btKinematicCharacterController(), jump(), and stepDown().
bool btKinematicCharacterController::m_wasOnGround [protected] |
Definition at line 75 of file btKinematicCharacterController.h.
Referenced by btKinematicCharacterController(), playerStep(), and stepDown().