gestalt Posted July 24, 2017 Report 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 Quote Link to comment Share on other sites More sharing options...
samme Posted July 24, 2017 Report Share Posted July 24, 2017 Quote Link to comment Share on other sites More sharing options...
gestalt Posted July 24, 2017 Author Report 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. Quote Link to comment Share on other sites More sharing options...
samme Posted July 24, 2017 Report 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 Quote Link to comment Share on other sites More sharing options...
gestalt Posted July 25, 2017 Author Report 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? Quote Link to comment Share on other sites More sharing options...
samme Posted July 25, 2017 Report Share Posted July 25, 2017 I think you can change it as long as you're careful. Quote Link to comment Share on other sites More sharing options...
gestalt Posted July 25, 2017 Author Report Share Posted July 25, 2017 thank you so much! it's a good experience for me Quote Link to comment Share on other sites More sharing options...
samme Posted July 25, 2017 Report Share Posted July 25, 2017 Here was the revised example: Quote Link to comment Share on other sites More sharing options...
ChrisyChris Posted June 16, 2019 Report 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.