Blender V2.61 - r43446
|
rayCast vehicle, very special constraint that turn a rigidbody into a vehicle. More...
#include <btRaycastVehicle.h>
Classes | |
class | btVehicleTuning |
Public Member Functions | |
btRaycastVehicle (const btVehicleTuning &tuning, btRigidBody *chassis, btVehicleRaycaster *raycaster) | |
virtual | ~btRaycastVehicle () |
virtual void | updateAction (btCollisionWorld *collisionWorld, btScalar step) |
btActionInterface interface | |
void | debugDraw (btIDebugDraw *debugDrawer) |
btActionInterface interface | |
const btTransform & | getChassisWorldTransform () const |
btScalar | rayCast (btWheelInfo &wheel) |
virtual void | updateVehicle (btScalar step) |
void | resetSuspension () |
btScalar | getSteeringValue (int wheel) const |
void | setSteeringValue (btScalar steering, int wheel) |
void | applyEngineForce (btScalar force, int wheel) |
const btTransform & | getWheelTransformWS (int wheelIndex) const |
void | updateWheelTransform (int wheelIndex, bool interpolatedTransform=true) |
btWheelInfo & | addWheel (const btVector3 &connectionPointCS0, const btVector3 &wheelDirectionCS0, const btVector3 &wheelAxleCS, btScalar suspensionRestLength, btScalar wheelRadius, const btVehicleTuning &tuning, bool isFrontWheel) |
int | getNumWheels () const |
const btWheelInfo & | getWheelInfo (int index) const |
btWheelInfo & | getWheelInfo (int index) |
void | updateWheelTransformsWS (btWheelInfo &wheel, bool interpolatedTransform=true) |
void | setBrake (btScalar brake, int wheelIndex) |
void | setPitchControl (btScalar pitch) |
void | updateSuspension (btScalar deltaTime) |
virtual void | updateFriction (btScalar timeStep) |
btRigidBody * | getRigidBody () |
const btRigidBody * | getRigidBody () const |
int | getRightAxis () const |
int | getUpAxis () const |
int | getForwardAxis () const |
btVector3 | getForwardVector () const |
Worldspace forward vector. | |
btScalar | getCurrentSpeedKmHour () const |
Velocity of vehicle (positive if velocity vector has same direction as foward vector) | |
virtual void | setCoordinateSystem (int rightIndex, int upIndex, int forwardIndex) |
int | getUserConstraintType () const |
backwards compatibility | |
void | setUserConstraintType (int userConstraintType) |
void | setUserConstraintId (int uid) |
int | getUserConstraintId () const |
Public Attributes | |
btAlignedObjectArray< btWheelInfo > | m_wheelInfo |
rayCast vehicle, very special constraint that turn a rigidbody into a vehicle.
Definition at line 25 of file btRaycastVehicle.h.
btRaycastVehicle::btRaycastVehicle | ( | const btVehicleTuning & | tuning, |
btRigidBody * | chassis, | ||
btVehicleRaycaster * | raycaster | ||
) |
Definition at line 35 of file btRaycastVehicle.cpp.
btRaycastVehicle::~btRaycastVehicle | ( | ) | [virtual] |
Definition at line 57 of file btRaycastVehicle.cpp.
btWheelInfo & btRaycastVehicle::addWheel | ( | const btVector3 & | connectionPointCS0, |
const btVector3 & | wheelDirectionCS0, | ||
const btVector3 & | wheelAxleCS, | ||
btScalar | suspensionRestLength, | ||
btScalar | wheelRadius, | ||
const btVehicleTuning & | tuning, | ||
bool | isFrontWheel | ||
) |
Definition at line 65 of file btRaycastVehicle.cpp.
References getNumWheels(), btWheelInfoConstructionInfo::m_bIsFrontWheel, btWheelInfoConstructionInfo::m_chassisConnectionCS, btRaycastVehicle::btVehicleTuning::m_frictionSlip, btWheelInfoConstructionInfo::m_frictionSlip, btRaycastVehicle::btVehicleTuning::m_maxSuspensionForce, btWheelInfoConstructionInfo::m_maxSuspensionForce, btRaycastVehicle::btVehicleTuning::m_maxSuspensionTravelCm, btWheelInfoConstructionInfo::m_maxSuspensionTravelCm, btRaycastVehicle::btVehicleTuning::m_suspensionCompression, btRaycastVehicle::btVehicleTuning::m_suspensionDamping, btWheelInfoConstructionInfo::m_suspensionRestLength, btWheelInfoConstructionInfo::m_suspensionStiffness, btRaycastVehicle::btVehicleTuning::m_suspensionStiffness, btWheelInfoConstructionInfo::m_wheelAxleCS, btWheelInfoConstructionInfo::m_wheelDirectionCS, m_wheelInfo, btWheelInfoConstructionInfo::m_wheelRadius, btWheelInfoConstructionInfo::m_wheelsDampingCompression, btWheelInfoConstructionInfo::m_wheelsDampingRelaxation, btAlignedObjectArray< T >::push_back(), updateWheelTransform(), and updateWheelTransformsWS().
Referenced by WrapperVehicle::AddWheel().
void btRaycastVehicle::applyEngineForce | ( | btScalar | force, |
int | wheel | ||
) |
Definition at line 382 of file btRaycastVehicle.cpp.
References btAssert, getNumWheels(), getWheelInfo(), and btWheelInfo::m_engineForce.
Referenced by WrapperVehicle::ApplyEngineForce().
void btRaycastVehicle::debugDraw | ( | btIDebugDraw * | debugDrawer | ) | [virtual] |
btActionInterface interface
Implements btActionInterface.
Definition at line 719 of file btRaycastVehicle.cpp.
References btIDebugDraw::drawLine(), btTransform::getBasis(), getNumWheels(), btTransform::getOrigin(), getRightAxis(), getWheelInfo(), and btWheelInfo::m_worldTransform.
const btTransform & btRaycastVehicle::getChassisWorldTransform | ( | ) | const |
Definition at line 253 of file btRaycastVehicle.cpp.
References btRigidBody::getCenterOfMassTransform(), and getRigidBody().
Referenced by getForwardVector(), updateVehicle(), and updateWheelTransformsWS().
btScalar btRaycastVehicle::getCurrentSpeedKmHour | ( | ) | const [inline] |
Velocity of vehicle (positive if velocity vector has same direction as foward vector)
Definition at line 185 of file btRaycastVehicle.h.
int btRaycastVehicle::getForwardAxis | ( | ) | const [inline] |
Definition at line 165 of file btRaycastVehicle.h.
btVector3 btRaycastVehicle::getForwardVector | ( | ) | const [inline] |
Worldspace forward vector.
Definition at line 172 of file btRaycastVehicle.h.
References btTransform::getBasis(), and getChassisWorldTransform().
int btRaycastVehicle::getNumWheels | ( | ) | const [inline] |
Definition at line 119 of file btRaycastVehicle.h.
References m_wheelInfo, and btAlignedObjectArray< T >::size().
Referenced by addWheel(), applyEngineForce(), debugDraw(), WrapperVehicle::GetNumWheels(), getWheelInfo(), getWheelTransformWS(), setBrake(), setSteeringValue(), updateFriction(), updateSuspension(), and updateVehicle().
int btRaycastVehicle::getRightAxis | ( | ) | const [inline] |
Definition at line 156 of file btRaycastVehicle.h.
Referenced by debugDraw().
btRigidBody* btRaycastVehicle::getRigidBody | ( | ) | [inline] |
Definition at line 146 of file btRaycastVehicle.h.
Referenced by getChassisWorldTransform(), rayCast(), updateFriction(), updateVehicle(), and updateWheelTransformsWS().
const btRigidBody* btRaycastVehicle::getRigidBody | ( | ) | const [inline] |
Definition at line 151 of file btRaycastVehicle.h.
btScalar btRaycastVehicle::getSteeringValue | ( | int | wheel | ) | const |
Definition at line 376 of file btRaycastVehicle.cpp.
References getWheelInfo(), and btWheelInfo::m_steering.
int btRaycastVehicle::getUpAxis | ( | ) | const [inline] |
Definition at line 160 of file btRaycastVehicle.h.
int btRaycastVehicle::getUserConstraintId | ( | ) | const [inline] |
Definition at line 214 of file btRaycastVehicle.h.
Referenced by CcdPhysicsEnvironment::createConstraint(), WrapperVehicle::GetUserConstraintId(), and CcdPhysicsEnvironment::getVehicleConstraint().
int btRaycastVehicle::getUserConstraintType | ( | ) | const [inline] |
backwards compatibility
Definition at line 199 of file btRaycastVehicle.h.
Referenced by WrapperVehicle::GetUserConstraintType().
const btWheelInfo & btRaycastVehicle::getWheelInfo | ( | int | index | ) | const |
Definition at line 390 of file btRaycastVehicle.cpp.
References btAssert, getNumWheels(), and m_wheelInfo.
Referenced by WrapperVehicle::ApplyBraking(), applyEngineForce(), debugDraw(), getSteeringValue(), WrapperVehicle::GetWheelRotation(), setBrake(), WrapperVehicle::SetRollInfluence(), setSteeringValue(), WrapperVehicle::SetSuspensionCompression(), WrapperVehicle::SetSuspensionDamping(), WrapperVehicle::SetSuspensionStiffness(), WrapperVehicle::SetWheelFriction(), and WrapperVehicle::SyncWheels().
btWheelInfo & btRaycastVehicle::getWheelInfo | ( | int | index | ) |
Definition at line 397 of file btRaycastVehicle.cpp.
References btAssert, getNumWheels(), and m_wheelInfo.
const btTransform & btRaycastVehicle::getWheelTransformWS | ( | int | wheelIndex | ) | const |
Definition at line 95 of file btRaycastVehicle.cpp.
References btAssert, getNumWheels(), m_wheelInfo, and btWheelInfo::m_worldTransform.
Referenced by WrapperVehicle::GetWheelOrientationQuaternion(), WrapperVehicle::GetWheelPosition(), and updateFriction().
btScalar btRaycastVehicle::rayCast | ( | btWheelInfo & | wheel | ) |
Definition at line 167 of file btRaycastVehicle.cpp.
References btAssert, btVehicleRaycaster::castRay(), btRigidBody::getCenterOfMassPosition(), btActionInterface::getFixedBody(), getRigidBody(), btWheelInfo::getSuspensionRestLength(), btRigidBody::getVelocityInLocalPoint(), btWheelInfo::m_clippedInvContactDotSuspension, btVehicleRaycaster::btVehicleRaycasterResult::m_distFraction, btVehicleRaycaster::btVehicleRaycasterResult::m_hitNormalInWorld, btVehicleRaycaster::btVehicleRaycasterResult::m_hitPointInWorld, btWheelInfo::m_maxSuspensionTravelCm, btWheelInfo::m_raycastInfo, btWheelInfo::m_suspensionRelativeVelocity, btWheelInfo::m_wheelsRadius, and updateWheelTransformsWS().
Referenced by updateVehicle().
void btRaycastVehicle::resetSuspension | ( | ) |
Definition at line 136 of file btRaycastVehicle.cpp.
References btWheelInfo::getSuspensionRestLength(), i, btWheelInfo::m_clippedInvContactDotSuspension, btWheelInfo::m_raycastInfo, btWheelInfo::m_suspensionRelativeVelocity, m_wheelInfo, and btAlignedObjectArray< T >::size().
void btRaycastVehicle::setBrake | ( | btScalar | brake, |
int | wheelIndex | ||
) |
Definition at line 404 of file btRaycastVehicle.cpp.
References btAssert, getNumWheels(), getWheelInfo(), and btWheelInfo::m_brake.
virtual void btRaycastVehicle::setCoordinateSystem | ( | int | rightIndex, |
int | upIndex, | ||
int | forwardIndex | ||
) | [inline, virtual] |
Definition at line 190 of file btRaycastVehicle.h.
Referenced by WrapperVehicle::SetCoordinateSystem().
void btRaycastVehicle::setPitchControl | ( | btScalar | pitch | ) | [inline] |
Definition at line 135 of file btRaycastVehicle.h.
void btRaycastVehicle::setSteeringValue | ( | btScalar | steering, |
int | wheel | ||
) |
Definition at line 366 of file btRaycastVehicle.cpp.
References btAssert, getNumWheels(), getWheelInfo(), and btWheelInfo::m_steering.
Referenced by WrapperVehicle::SetSteeringValue().
void btRaycastVehicle::setUserConstraintId | ( | int | uid | ) | [inline] |
Definition at line 209 of file btRaycastVehicle.h.
Referenced by CcdPhysicsEnvironment::createConstraint().
void btRaycastVehicle::setUserConstraintType | ( | int | userConstraintType | ) | [inline] |
Definition at line 204 of file btRaycastVehicle.h.
Referenced by CcdPhysicsEnvironment::createConstraint().
virtual void btRaycastVehicle::updateAction | ( | btCollisionWorld * | collisionWorld, |
btScalar | step | ||
) | [inline, virtual] |
btActionInterface interface
Implements btActionInterface.
Definition at line 85 of file btRaycastVehicle.h.
References updateVehicle().
void btRaycastVehicle::updateFriction | ( | btScalar | timeStep | ) | [virtual] |
Definition at line 526 of file btRaycastVehicle.cpp.
References btRigidBody::applyImpulse(), btSqrt(), calcRollingFriction(), btTransform::getBasis(), btRigidBody::getCenterOfMassPosition(), btRigidBody::getCenterOfMassTransform(), btMatrix3x3::getColumn(), getNumWheels(), getRigidBody(), getWheelTransformWS(), i, if(), btWheelInfo::m_brake, btWheelInfo::m_engineForce, btWheelInfo::m_frictionSlip, btWheelInfo::m_raycastInfo, btWheelInfo::m_rollInfluence, m_wheelInfo, btWheelInfo::m_wheelsSuspensionForce, btAlignedObjectArray< T >::resize(), resolveSingleBilateral(), and sideFrictionStiffness2.
Referenced by updateVehicle().
void btRaycastVehicle::updateSuspension | ( | btScalar | deltaTime | ) |
Definition at line 411 of file btRaycastVehicle.cpp.
References btRigidBody::getInvMass(), getNumWheels(), btWheelInfo::getSuspensionRestLength(), btWheelInfo::m_clippedInvContactDotSuspension, btWheelInfo::m_raycastInfo, btWheelInfo::m_suspensionRelativeVelocity, btWheelInfo::m_suspensionStiffness, m_wheelInfo, btWheelInfo::m_wheelsDampingCompression, btWheelInfo::m_wheelsDampingRelaxation, and btWheelInfo::m_wheelsSuspensionForce.
Referenced by updateVehicle().
void btRaycastVehicle::updateVehicle | ( | btScalar | step | ) | [virtual] |
Definition at line 268 of file btRaycastVehicle.cpp.
References btRigidBody::applyImpulse(), btTransform::getBasis(), btRigidBody::getCenterOfMassPosition(), getChassisWorldTransform(), btRigidBody::getLinearVelocity(), getNumWheels(), getRigidBody(), btRigidBody::getVelocityInLocalPoint(), i, btWheelInfo::m_deltaRotation, btWheelInfo::m_maxSuspensionForce, btWheelInfo::m_raycastInfo, btWheelInfo::m_rotation, m_wheelInfo, btWheelInfo::m_wheelsRadius, btWheelInfo::m_wheelsSuspensionForce, rayCast(), btAlignedObjectArray< T >::size(), step(), updateFriction(), updateSuspension(), and updateWheelTransform().
Referenced by updateAction().
void btRaycastVehicle::updateWheelTransform | ( | int | wheelIndex, |
bool | interpolatedTransform = true |
||
) |
Definition at line 103 of file btRaycastVehicle.cpp.
References btWheelInfo::m_raycastInfo, btWheelInfo::m_rotation, btWheelInfo::m_steering, m_wheelInfo, btWheelInfo::m_worldTransform, btTransform::setBasis(), btTransform::setOrigin(), and updateWheelTransformsWS().
Referenced by addWheel(), WrapperVehicle::SyncWheels(), and updateVehicle().
void btRaycastVehicle::updateWheelTransformsWS | ( | btWheelInfo & | wheel, |
bool | interpolatedTransform = true |
||
) |
Definition at line 152 of file btRaycastVehicle.cpp.
References btTransform::getBasis(), getChassisWorldTransform(), btRigidBody::getMotionState(), getRigidBody(), btMotionState::getWorldTransform(), btWheelInfo::m_chassisConnectionPointCS, btWheelInfo::m_raycastInfo, btWheelInfo::m_wheelAxleCS, and btWheelInfo::m_wheelDirectionCS.
Referenced by addWheel(), rayCast(), and updateWheelTransform().
Definition at line 123 of file btRaycastVehicle.h.
Referenced by addWheel(), getNumWheels(), getWheelInfo(), getWheelTransformWS(), resetSuspension(), updateFriction(), updateSuspension(), updateVehicle(), and updateWheelTransform().