fenomas / noa

Experimental voxel game engine.
MIT License
616 stars 91 forks source link

Fix render events to pass correct `dt` values #57

Closed fenomas closed 5 years ago

fenomas commented 5 years ago

beforeRender and afterRender events (from noa object) currently pass a dt argument equal to the number of ms elapsed since the last tick. This was done because the physics system needs that info, but general event consumers would expect dt to be the ms since the previous event.

As part of fix, add new noa.positionInCurrentTick property, which gets updated before each tick. That is, if noa.positionInCurrentTick is 0.25, then at the time of that render event the time since the last tick would be 1/4 of the noa._tickRate.

fenomas commented 5 years ago

This is fixed in the dev branch as of a week or two ago.