对于动作脚本,我需要一种以微秒而不是毫秒为单位的高精度时间方法,不幸的是我在网络上找不到太多帮助。

我需要这样的控制才能实现在转换中使用固定时间步长,如本文所述: http://gafferongames.com/game-physicals/fix-your-timestep/, ,为了解决我描述的问题 优化 2D Flash 游戏的过渡/移动平滑度

有什么建议么?

有帮助吗?

解决方案

这是不可能的。

其他提示

虽然不是准确疯狂,相信这具有比依靠ENTER_FRAME方式更多的时间精确度。

public var t:Timer;
public var initialTime:int;

public function setup():void{
    t=new Timer(1000); //in miliseconds
    t.addEventListener(TimerEvent.TIMER, onTimerTick);
    t.start();
    initialTime=getTimer();
}

public function onTimerTick(e:TimerEvent):void{
    trace("elapsed:"+getTimer()-initialTime);
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top