Proper Task updatinng

Hey all, Ive been trying to figure out how to get my main task to update in a way where my games speed is not fps dependent. Right now i have

FPS = 60
        globalClock = ClockObject.getGlobalClock()
        globalClock.setMode(ClockObject.MLimited)
        globalClock.setFrameRate(FPS)

and

def dtTimer(self):
        #globalClock.setDt((globalClock.getFrameCount()/globalClock.getRealTime())/10000)
        #globalClock.setFrameTime(globalClock.getDt())
        globalClock.setDt(.01667)

    def update(self, task):
        ##############################################
        #              #BULLET UPDATE#               #
        ##############################################
        dt = globalClock.getDt()
        #self.dtTimer()
        print(dt)
        self.world.doPhysics(dt)

But As the framerate drops the games speed drops. What is the proper way to do this?

Have you tried simply using the default GlobalClock object and passing in its dt as each frame? Something like this:

# in our initialisation method:
    self.updateTask = taskMgr.add(self.update, "update")

# Elsewhere:
def update(self, task):
    dt = globalClock.getDt() # Note that I haven't assigned or changed globalClock; I'm using the default
    self.world.doPhysics(dt)

Bullet has it’s own internal clock. BulletWorld.doPhysics has two optional arguments you might not have been aware of. They should help you keep things in synch.

int doPhysics (float dt, int max_substeps, float stepsize)

Read this for more information (stepSimulation is the same underlying function):
http://bulletphysics.org/mediawiki-1.5.8/index.php/Stepping_the_World

you are awesome! exactly what i needed :smiley: