currentTimeStep issues

Discuss new features and future development.
Post Reply
horseshoe7
Posts: 36
Joined: Fri Feb 19, 2010 11:58 am
Contact:

currentTimeStep issues

Post by horseshoe7 »

from the name of the property, currentTimeStep suggests to me that one can use this as a way to keep track of how many steps have occurred in the simulation. this therefore suggests that this value will either be the same, or greater than any other point in your code you access it.

Code: Select all

    // update the timestamp
    cpFloat timestamp = _space.currentTimeStep;

    // check if anything is new
    if(timestamp < _lastTimestamp)
        return; // this should never happen, and yet it does...
Have I misunderstood? How would I accomplish what I'm hoping to. i.e. 'simulated amount of time thus far' ??
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: currentTimeStep issues

Post by slembcke »

I guess the docs could be more clear on that, but it's the most current delta time value (the timestep) you passed to cpSpaceStep().
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
horseshoe7
Posts: 36
Joined: Fri Feb 19, 2010 11:58 am
Contact:

Re: currentTimeStep issues

Post by horseshoe7 »

So if I wanted to keep track of 'simulation time' i could just subclass a ChipmunkSpace, add this property, and whenever step: is called, just add that to my new ivar?

UPDATE: I'll just answer my own question. Yes. This is what I did and it's working as expected. Thanks again for your speedy replies!
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests