zetsubou Posted December 10, 2018 Share Posted December 10, 2018 Hi. When game object reaches high speed on y axis it might fall through a ground layer(that supposed to be collided with). Can I fix it somehow? Perhaps increase frequency of collision checking(Is it possible in Phaser?). Link to comment Share on other sites More sharing options...
Milton Posted December 10, 2018 Share Posted December 10, 2018 If you use Matter: You can adjust the number of iterations that Engine.update performs internally. Use the Scene Matter Physics config object to set the following properties: positionIterations (defaults to 6) velocityIterations (defaults to 4) constraintIterations (defaults to 2) If you use Arcade you could just alter World.js a bit where it says (in update): this.step(fixedDelta); zetsubou 1 Link to comment Share on other sites More sharing options...
zetsubou Posted December 10, 2018 Author Share Posted December 10, 2018 Thanks, @Milton! Link to comment Share on other sites More sharing options...
zetsubou Posted December 10, 2018 Author Share Posted December 10, 2018 @Milton, is that the only solution available? I mean I got no choice, but it feels kind of awkward changing phaser native code. And it just accelerates the game. Player still sometimes falls through the ground. Link to comment Share on other sites More sharing options...
zetsubou Posted December 10, 2018 Author Share Posted December 10, 2018 So, I came up with a solution that works(so far). I just made a setInterval with callback(collider.update()) with 3ms(perhaps I can set more seconds) delay. But there is still a performance problem. There is my loop and phaser loop, so I invoke update more, than enough. Link to comment Share on other sites More sharing options...
Milton Posted December 10, 2018 Share Posted December 10, 2018 3ms is insane. I would suggest switching to Matter, and configuring your collision. Link to comment Share on other sites More sharing options...
zetsubou Posted December 10, 2018 Author Share Posted December 10, 2018 @Milton, that's insane for sure, but I have already made a lot, I just cannot switch to another game engine. Link to comment Share on other sites More sharing options...
Milton Posted December 10, 2018 Share Posted December 10, 2018 You still use Phaser, just a different Physics engine. Matter is a lot more advanced than Arcade, and not much slower... Link to comment Share on other sites More sharing options...
Antriel Posted December 10, 2018 Share Posted December 10, 2018 You can increase the `fps` parameter of Arcade in game config. Link to comment Share on other sites More sharing options...
Recommended Posts