Set fixed timestep to delta time by default
This commit is contained in:
@@ -328,7 +328,8 @@ bool rc_windowOpenEx(std::string title, int x, int y, int w, int h, uint32_t win
|
|||||||
rc_physics3D.TimeStamp = SDL_GetTicks(); //device->getTimer()->getTime();
|
rc_physics3D.TimeStamp = SDL_GetTicks(); //device->getTimer()->getTime();
|
||||||
|
|
||||||
rc_physics3D.maxSubSteps = 1;
|
rc_physics3D.maxSubSteps = 1;
|
||||||
rc_physics3D.fixedTimeStep = irr::f32(1.) / irr::f64(60.);
|
//rc_physics3D.fixedTimeStep = irr::f32(1.) / irr::f64(60.);
|
||||||
|
rc_physics3D.fixedTimeStep = -1;
|
||||||
|
|
||||||
rc_physics3D.world->setInternalTickCallback((btInternalTickCallback)myTickCallback2);
|
rc_physics3D.world->setInternalTickCallback((btInternalTickCallback)myTickCallback2);
|
||||||
|
|
||||||
@@ -3047,7 +3048,8 @@ void rc_preUpdate()
|
|||||||
//rc_physics3D.TimeStamp = device->getTimer()->getTime();
|
//rc_physics3D.TimeStamp = device->getTimer()->getTime();
|
||||||
rc_physics3D.DeltaTime = SDL_GetTicks() - rc_physics3D.TimeStamp;
|
rc_physics3D.DeltaTime = SDL_GetTicks() - rc_physics3D.TimeStamp;
|
||||||
rc_physics3D.TimeStamp = SDL_GetTicks();
|
rc_physics3D.TimeStamp = SDL_GetTicks();
|
||||||
rc_physics3D.world->stepSimulation(rc_physics3D.DeltaTime*0.001f, rc_physics3D.maxSubSteps, rc_physics3D.fixedTimeStep);
|
float fixed_timestep = rc_physics3D.fixedTimeStep < 0 ? rc_physics3D.DeltaTime*0.001f : rc_physics3D.fixedTimeStep;
|
||||||
|
rc_physics3D.world->stepSimulation(rc_physics3D.DeltaTime*0.001f, rc_physics3D.maxSubSteps, fixed_timestep);
|
||||||
|
|
||||||
for(int i = 0; i < rc_canvas.size(); i++)
|
for(int i = 0; i < rc_canvas.size(); i++)
|
||||||
{
|
{
|
||||||
@@ -3459,7 +3461,8 @@ bool rc_update()
|
|||||||
//rc_physics3D.TimeStamp = device->getTimer()->getTime();
|
//rc_physics3D.TimeStamp = device->getTimer()->getTime();
|
||||||
rc_physics3D.DeltaTime = SDL_GetTicks() - rc_physics3D.TimeStamp;
|
rc_physics3D.DeltaTime = SDL_GetTicks() - rc_physics3D.TimeStamp;
|
||||||
rc_physics3D.TimeStamp = SDL_GetTicks();
|
rc_physics3D.TimeStamp = SDL_GetTicks();
|
||||||
rc_physics3D.world->stepSimulation(rc_physics3D.DeltaTime*0.001f, rc_physics3D.maxSubSteps, rc_physics3D.fixedTimeStep);
|
float fixed_timestep = rc_physics3D.fixedTimeStep < 0 ? rc_physics3D.DeltaTime*0.001f : rc_physics3D.fixedTimeStep;
|
||||||
|
rc_physics3D.world->stepSimulation(rc_physics3D.DeltaTime*0.001f, rc_physics3D.maxSubSteps, fixed_timestep);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < rc_canvas.size(); i++)
|
for(int i = 0; i < rc_canvas.size(); i++)
|
||||||
|
|||||||
@@ -307,6 +307,7 @@ struct rc_physicsWorld2D_obj
|
|||||||
b2World* world;
|
b2World* world;
|
||||||
|
|
||||||
rc_contactListener_obj* contact_listener;
|
rc_contactListener_obj* contact_listener;
|
||||||
|
float time_stamp;
|
||||||
float timeStep = 1/60.0; //the length of time passed to simulate (seconds)
|
float timeStep = 1/60.0; //the length of time passed to simulate (seconds)
|
||||||
int velocityIterations = 8; //how strongly to correct velocity
|
int velocityIterations = 8; //how strongly to correct velocity
|
||||||
int positionIterations = 3; //how strongly to correct position
|
int positionIterations = 3; //how strongly to correct position
|
||||||
|
|||||||
@@ -1247,7 +1247,7 @@
|
|||||||
1727545973 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/RealisticWater.h
|
1727545973 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/RealisticWater.h
|
||||||
<irrlicht.h>
|
<irrlicht.h>
|
||||||
|
|
||||||
1733023077 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_gfx.h
|
1733027113 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_gfx.h
|
||||||
"SDL.h"
|
"SDL.h"
|
||||||
<SDL2/SDL.h>
|
<SDL2/SDL.h>
|
||||||
<irrlicht.h>
|
<irrlicht.h>
|
||||||
@@ -1271,7 +1271,7 @@
|
|||||||
"rc_joints.h"
|
"rc_joints.h"
|
||||||
<irrtheora.h>
|
<irrtheora.h>
|
||||||
|
|
||||||
1732372339 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_gfx_core.h
|
1733027113 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_gfx_core.h
|
||||||
"SDL.h"
|
"SDL.h"
|
||||||
"btBulletDynamicsCommon.h"
|
"btBulletDynamicsCommon.h"
|
||||||
"BulletSoftBody/btSoftRigidDynamicsWorld.h"
|
"BulletSoftBody/btSoftRigidDynamicsWorld.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user