Add Character control to btDiscreteDynamicsWorld (moved btCharacterControllerInterface/btKinematicCharacterController functionality from demo)

Remove ibmsdk from CcdPhysicsDemo and CollisionDemo
This commit is contained in:
erwin.coumans
2008-11-08 21:01:20 +00:00
parent ce0bdd891d
commit f9aa7f3b53
13 changed files with 289 additions and 353 deletions

View File

@@ -51,6 +51,9 @@ subject to the following restrictions:
#include "BulletDynamics/Vehicle/btRaycastVehicle.h"
#include "BulletDynamics/Vehicle/btVehicleRaycaster.h"
#include "BulletDynamics/Vehicle/btWheelInfo.h"
//character
#include "BulletDynamics/Character/btCharacterControllerInterface.h"
#include "LinearMath/btIDebugDraw.h"
#include "LinearMath/btQuickprof.h"
#include "LinearMath/btMotionState.h"
@@ -403,7 +406,8 @@ void btDiscreteDynamicsWorld::internalSingleStepSimulation(btScalar timeStep)
///update vehicle simulation
updateVehicles(timeStep);
updateCharacters(timeStep);
updateActivationState( timeStep );
@@ -479,6 +483,20 @@ void btDiscreteDynamicsWorld::updateVehicles(btScalar timeStep)
}
}
void btDiscreteDynamicsWorld::updateCharacters(btScalar timeStep)
{
BT_PROFILE("updateCharacters");
for ( int i=0;i<m_characters.size();i++)
{
btCharacterControllerInterface* character = m_characters[i];
character->preStep (this);
character->playerStep (this,timeStep);
}
}
void btDiscreteDynamicsWorld::updateActivationState(btScalar timeStep)
{
BT_PROFILE("updateActivationState");
@@ -543,6 +561,17 @@ void btDiscreteDynamicsWorld::removeVehicle(btRaycastVehicle* vehicle)
m_vehicles.remove(vehicle);
}
void btDiscreteDynamicsWorld::addCharacter(btCharacterControllerInterface* character)
{
m_characters.push_back(character);
}
void btDiscreteDynamicsWorld::removeCharacter(btCharacterControllerInterface* character)
{
m_characters.remove(character);
}
SIMD_FORCE_INLINE int btGetConstraintIslandId(const btTypedConstraint* lhs)
{
int islandId;