1 decade ago by Ransome
Hi all, got an interesting little bug here. I've got a bunch of blocks I'm trying to stack on top of each other, very simple things really with a vel.y of 100 or so. When I start them above each other they fall and stack fine (their collision is fixed). But when I do a sortEntities() after initializing all of them they fall through each other and then seem to 'pop' into place (in some cases) after they're done.
Also, I tried making them 'ACTIVE' collisions but they all bounced up in the air which I didn't want (even after setting .bounciness=0).
Here's them all stacking properly:
this.spawnEntity('EntityBlock',130,250,{blocktype:'small'}); this.spawnEntity('EntityBlock',130,20,{blocktype:'medium'}); this.spawnEntity('EntityBlock',270,250,{blocktype:'medium'}); this.spawnEntity('EntityBlock',270,20,{blocktype:'medium'}); this.spawnEntity('EntityBlock',410,250,{blocktype:'small'}); this.spawnEntity('EntityBlock',410,10,{blocktype:'small'}); this.spawnEntity('EntityBlock',540,140,{blocktype:'medium'}); this.spawnEntity('EntityBlock',540,5,{blocktype:'small'}); this.spawnEntity('EntityBlock',680,350,{blocktype:'large'}); this.spawnEntity('EntityBlock',680,5,{blocktype:'small'}); this.setupMenuBar(); this.sortEntities();
And also sortEntitiesDeferred did the same thing.
Also, I tried making them 'ACTIVE' collisions but they all bounced up in the air which I didn't want (even after setting .bounciness=0).
Here's them all stacking properly:
this.spawnEntity('EntityBlock',130,250,{blocktype:'small'}); this.spawnEntity('EntityBlock',130,20,{blocktype:'medium'}); this.spawnEntity('EntityBlock',270,250,{blocktype:'medium'}); this.spawnEntity('EntityBlock',270,20,{blocktype:'medium'}); this.spawnEntity('EntityBlock',410,250,{blocktype:'small'}); this.spawnEntity('EntityBlock',410,10,{blocktype:'small'}); this.spawnEntity('EntityBlock',540,140,{blocktype:'medium'}); this.spawnEntity('EntityBlock',540,5,{blocktype:'small'}); this.spawnEntity('EntityBlock',680,350,{blocktype:'large'}); this.spawnEntity('EntityBlock',680,5,{blocktype:'small'}); this.setupMenuBar(); this.sortEntities();
And also sortEntitiesDeferred did the same thing.