Skip to content

Commit 97bb79e

Browse files
committed
Improve queueUpdate
1 parent 4b06bb3 commit 97bb79e

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.changeset/afraid-glasses-carry.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"planck": patch
3+
---
4+
5+
Improve world.queueUpdate

src/dynamics/World.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export class World {
128128
/** @internal */ m_positionIterations: number;
129129
/** @internal */ m_t: number;
130130

131-
/** @internal */ m_step_callback: ((world: World) => unknown)[] = [];
131+
/** @internal */ m_step_callback: ((world: World) => unknown)[];
132132

133133
// TODO
134134
/** @internal */ _listeners: {
@@ -186,6 +186,8 @@ export class World {
186186
this.m_positionIterations = def.positionIterations;
187187

188188
this.m_t = 0;
189+
190+
this.m_step_callback = [];
189191
}
190192

191193
/** @internal */
@@ -861,7 +863,7 @@ export class World {
861863
this.m_locked = false;
862864

863865
let callback: (world: World) => unknown;
864-
while(callback = this.m_step_callback.pop()) {
866+
while(callback = this.m_step_callback.shift()) {
865867
callback(this);
866868
}
867869

0 commit comments

Comments
 (0)