objective c - SKScene's update method gets a "currentTime" that is different from CFAbsoluteTimeGetCurrent() -
the problem can reproduced in freshly created spritekit project.
after creating new project, add 2 lines update: method of myscene class:
-(void)update:(cftimeinterval)currenttime { nslog(@" currenttime = %f", currenttime); nslog(@"cfabsolutetimegetcurrent() = %f", cfabsolutetimegetcurrent()); }
running shows currenttime several orders of magnitude smaller time returned cfabsolutetimegetcurrent(). searched possible reasons, found none. possibility think of currenttime time frame since other date 00:00:00 01.01.2000, have no idea other reference point using, , found nothing when searching online either.
what can current time, calculated same rules used calculate currenttime?
nothing, unless you're willing disassemble , understand sprite kit framework code.
though problem explained sprite kit taking cfabsolutetimegetcurrent @ earlier point in time, passed update: method. overhead of sending message scene means 2 times can't same. or currenttime may not obtained cfabsolutetimegetcurrent other means.
what can currenttime of first time update: runs , store in ivar. can use time reference time scene.
Comments
Post a Comment