currentTimeStep issues

Discuss new features and future development.

currentTimeStep issues

Postby horseshoe7 » Sun Jul 07, 2013 4:24 pm

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' ??
horseshoe7
 
Posts: 36
Joined: Fri Feb 19, 2010 11:58 am

Re: currentTimeStep issues

Postby slembcke » Sun Jul 07, 2013 10:22 pm

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/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: currentTimeStep issues

Postby horseshoe7 » Mon Jul 08, 2013 3:10 am

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!
horseshoe7
 
Posts: 36
Joined: Fri Feb 19, 2010 11:58 am


Return to Features/Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron