gestalt Posted July 24, 2017 Share Posted July 24, 2017 hi, because some issue, so i using group to create sprite as my colliders. var octopus; var colliders; var col; function create() { octopus = game.add.sprite(300, 200, 'octopus'); colliders = game.make.group(octopus, 'colliders', null, true, Phaser.Physics.ARCADE); octopus.updateTransform(); col = colliders.create(0, 0); col.body.setCircle(30, -30, -30); col.body.reset(colliders.worldPosition.x + col.x, colliders.worldPosition.y + col.y); game.debug.body(col, 'rgba(255,0,0,0.5)'); } function update(){ game.debug.body(col, 'rgba(255,0,0,0.5)'); } in the example, the body will flash to another point and then go back to the correct position. if i try to use Arcade Physics's overlap in two group. although two group is not overlap. that still cause overlap event. sorry about my english is not well Link to comment Share on other sites More sharing options...
samme Posted July 24, 2017 Share Posted July 24, 2017 Link to comment Share on other sites More sharing options...
gestalt Posted July 24, 2017 Author Share Posted July 24, 2017 thanks for your example! if you try to refresh the example, you will see debug body flash in the left top, just close to the first few frames. that is my trouble, because i need body set in correct position at the first time, but sprite's body there are different position in create() and update(). so if i have multiple object in the create level, that cause there are overlap in the first time, and then and then become normal. I don't want objects to happen overlap event in an incorrect position. Link to comment Share on other sites More sharing options...
samme Posted July 24, 2017 Share Posted July 24, 2017 // Updates `worldPosition` this.stage.updateTransform(); colliders.forEach(function (c) { c.world.copyFrom(c.worldPosition); c.body.reset(c.world.x, c.world.y); c.fresh = false; // Don't modify `world` and `worldPosition` during preUpdate }, this); gestalt 1 Link to comment Share on other sites More sharing options...
gestalt Posted July 25, 2017 Author Share Posted July 25, 2017 THANKS! it's work. but i have a question, property of fresh is readonly in API, is it can be change? Link to comment Share on other sites More sharing options...
samme Posted July 25, 2017 Share Posted July 25, 2017 I think you can change it as long as you're careful. Link to comment Share on other sites More sharing options...
gestalt Posted July 25, 2017 Author Share Posted July 25, 2017 thank you so much! it's a good experience for me Link to comment Share on other sites More sharing options...
samme Posted July 25, 2017 Share Posted July 25, 2017 Here was the revised example: Link to comment Share on other sites More sharing options...
ChrisyChris Posted June 16, 2019 Share Posted June 16, 2019 On 7/25/2017 at 12:42 AM, samme said: // Updates `worldPosition` this.stage.updateTransform(); colliders.forEach(function (c) { c.world.copyFrom(c.worldPosition); c.body.reset(c.world.x, c.world.y); c.fresh = false; // Don't modify `world` and `worldPosition` during preUpdate }, this); I think I'm having the same issue here, but annoyingly I can't see most of @samme's answers on this thread, the only one I can see is the one I've quoted ^^. Can anyone tell me where it is that I need to add this code to fix the issue? Link to comment Share on other sites More sharing options...
Recommended Posts