aboutsummaryrefslogtreecommitdiff
path: root/src/shared/phys/physcommon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/phys/physcommon.cpp')
-rw-r--r--src/shared/phys/physcommon.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/shared/phys/physcommon.cpp b/src/shared/phys/physcommon.cpp
index c15274d..4f506bb 100644
--- a/src/shared/phys/physcommon.cpp
+++ b/src/shared/phys/physcommon.cpp
@@ -32,7 +32,7 @@ btCollisionDispatcher* Dispatcher;
btSequentialImpulseConstraintSolver* Solver;
void phys_genesis(){
- BroadPhase = new btAxisSweep3(btVector3(-1000, -1000, -1000), btVector3(1000, 1000, 1000));
+ BroadPhase = new btAxisSweep3(btVector3(-1000,-1000,-1000),btVector3(1000,1000,1000));
printf("Broadphase\n");
CollisionConfiguration = new btDefaultCollisionConfiguration();
printf("Collision config\n");
@@ -42,6 +42,8 @@ void phys_genesis(){
printf("Solver\n");
World = new btDiscreteDynamicsWorld(Dispatcher, BroadPhase, Solver, CollisionConfiguration);
printf("Physics world init ok.\n");
+ World->setGravity(btVector3(0,-10,0));
+ printf("Created physics world: %p\n",World);
}
void phys_shutdown(void(*f)(btRigidBody*)){
@@ -65,7 +67,7 @@ void phys_shutdown(void(*f)(btRigidBody*)){
// Runs the physics simulation.
// - TDeltaTime tells the simulation how much time has passed since the last frame so the simulation can run independently of the frame rate. Optionally pass in an argument that will be called on every rigidbody in the world
void UpdatePhysics(double TDeltaTime, void(*f)(btRigidBody*)) {
- World->stepSimulation(TDeltaTime * 0.02f, 60);
+ World->stepSimulation(TDeltaTime * 0.2f, 60);
if(f){
// Relay the object's orientation to irrlicht
for(std::list<btRigidBody *>::iterator it = Objects.begin(); it != Objects.end(); ++it) {
@@ -78,7 +80,7 @@ high_resolution_clock::time_point t1 = high_resolution_clock::now();
void gameloop_phys(void(*f)(btRigidBody*)){
high_resolution_clock::time_point now = high_resolution_clock::now();
duration<double> delta = now-t1;
- double steps = delta.count() * 100;
+ double steps = delta.count() * 10;
UpdatePhysics(steps,f);
t1 = now;
}