|
|
@@ -3,38 +3,29 @@
|
|
|
#include "anki/physics/MotionState.h"
|
|
|
#include <BulletCollision/CollisionDispatch/btGhostObject.h>
|
|
|
|
|
|
-
|
|
|
namespace anki {
|
|
|
|
|
|
-
|
|
|
-//==============================================================================
|
|
|
-// Constructor =
|
|
|
//==============================================================================
|
|
|
-PhysWorld::PhysWorld():
|
|
|
- defaultContactProcessingThreshold(BT_LARGE_FLOAT)
|
|
|
+PhysWorld::PhysWorld()
|
|
|
+ : defaultContactProcessingThreshold(BT_LARGE_FLOAT)
|
|
|
{
|
|
|
collisionConfiguration = new btDefaultCollisionConfiguration();
|
|
|
dispatcher = new btCollisionDispatcher(collisionConfiguration);
|
|
|
- broadphase = new btAxisSweep3(btVector3(-1000, -1000, -1000),
|
|
|
+ broadphase = new btAxisSweep3(
|
|
|
+ btVector3(-1000, -1000, -1000),
|
|
|
btVector3(1000, 1000, 1000));
|
|
|
sol = new btSequentialImpulseConstraintSolver;
|
|
|
- dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher, broadphase, sol,
|
|
|
- collisionConfiguration);
|
|
|
+ dynamicsWorld = new btDiscreteDynamicsWorld(
|
|
|
+ dispatcher, broadphase, sol, collisionConfiguration);
|
|
|
dynamicsWorld->setGravity(btVector3(0,-10, 0));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-//==============================================================================
|
|
|
-// Destructor =
|
|
|
//==============================================================================
|
|
|
PhysWorld::~PhysWorld()
|
|
|
{
|
|
|
- /// @todo
|
|
|
+ /// XXX
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-//==============================================================================
|
|
|
-// setDebugDrawer =
|
|
|
//==============================================================================
|
|
|
void PhysWorld::setDebugDrawer(btIDebugDraw* newDebugDrawer)
|
|
|
{
|
|
|
@@ -43,21 +34,17 @@ void PhysWorld::setDebugDrawer(btIDebugDraw* newDebugDrawer)
|
|
|
debugDrawer->setDebugMode(btIDebugDraw::DBG_DrawWireframe);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//==============================================================================
|
|
|
-// update =
|
|
|
-//==============================================================================
|
|
|
-void PhysWorld::update(float prevUpdateTime, float crntTime)
|
|
|
+void PhysWorld::update(F32 prevUpdateTime, F32 crntTime)
|
|
|
{
|
|
|
dynamicsWorld->stepSimulation(crntTime - prevUpdateTime);
|
|
|
|
|
|
// updateNonRigidBodiesMotionStates
|
|
|
- for(uint i = 0; i < characters.size(); i++)
|
|
|
+ for(U i = 0; i < characters.size(); i++)
|
|
|
{
|
|
|
characters[i]->motionState->setWorldTransform(
|
|
|
characters[i]->ghostObject->getWorldTransform());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-} // end namespace
|
|
|
+} // end namespace anki
|