hexus / phaser-arcade-slopes

:triangular_ruler: A Phaser CE plugin that brings sloped tile collision handling to the Arcade Physics engine
MIT License
126 stars 16 forks source link

Phaser 3 #53

Open Maeggi opened 6 years ago

Maeggi commented 6 years ago

Hello, planned a update to phaser 3?

hexus commented 6 years ago

Yes, I'm planning to port the plugin for Phaser 3.

Development hasn't started yet, but I'm sure it'll show up in Phaser News once released.

hexus commented 6 years ago

I have plans to release a separate plugin for Phaser 3 that also includes similar improvements for MatterJS, not just Arcade.

i.e. a solution to this problem without sacrificing tiles: http://labs.phaser.io/view.html?src=src/game%20objects/tilemap/collision/matter%20ghost%20collisions.js

hexus commented 6 years ago

Just to update this, hexus/phaser-slopes is now a thing after a month and a half of hacking away at MatterJS! The readme, tagged release and npm publish are in progress.

This is a new Phaser 3 plugin I've written that smooths out tilemap collisions for Matter, but it doesn't do anything for Arcade just yet.

I am still planning to either port or reimplement the behaviour of Arcade Slopes for the Phaser 3 plugin, it just might take a little while. :angel:

hexus commented 6 years ago

The aforementioned plugin has now been released. I'll post here and close this issue once it supports Arcade Physics.

Maeggi commented 6 years ago

That's amazing, thank you so much :+1:

AndreaBoeAbrahamsen commented 5 years ago

Hope you dont mind me asking what the progress is on this one? I am really excited for slopes support in Phaser 3 Arcade Physics :)

hexus commented 5 years ago

I've taken quite a break from Phaser related work lately, so I haven't continued development on these projects.

I'm still interested in implementing it though, as part of the hexus/phaser-slopes plugin. Feel free to keep an eye on both. Perhaps I'll be able to make some time over the summer. :slightly_smiling_face:

AndreaBoeAbrahamsen commented 5 years ago

Thank you for a quick response, and I understand well the need for a break from such a huge project. I am very interested in trying to implementing slopes in my game, and I would be eternally grateful if you could describe how you would go about implementing one of the slope tile types in Phaser 3, would you still use SAT? Would you override the collie method or would adding the slope collide logic to the processCallback be enough? If you dont have time I understand, thanks anyway 😃

hexus commented 5 years ago

I totally empathise with that enthusiasm! Slopes are game-changers, pun intended. :smile:

For the plugin, I would likely override the method if there was no easy way to augment Arcade's behaviour in Phaser 3 (and I'm not expecting there to be an easy way). That's how this Phaser 2 plugin works, and this helps keep the collision/overlap API the same for users of the plugin.

If you wanted to attempt this yourself using some SAT library, Arcade's process callback may well be enough for what you need, as it essentially lets you process the entire collision yourself. Inside such a callback, you could use your own polygon to represent the tile that's being collided with.

The tricky part is keeping these collisions smooth between tiles, and that's why I built a plugin in the first place. It's built to avoid collisions with internal edges; identical edges that belong to different tiles. That's where the real complexities lie.

For a super simple example of using SAT in Phaser 2 though, feel free to check out my phaser-sat-example project. It doesn't integrate with Arcade, but it should give you a pretty good idea.

I'm happier with how I've solved this problem in my initial Phaser 3 plugin, because it doesn't rely on heuristics or painstakingly manually tweaked data. Instead, it uses an algorithm ported from Box2D, which should work in all cases.

SHG42 commented 4 years ago

Good afternoon! I found your plugin after Googling around and I wanted to find out if you have any status updates on the Phaser 3 implementation for Arcade slopes?

hexus commented 4 years ago

Hello!

I still haven't taken the time to implement this for the Arcade Physics engine in Phaser 3 over the past year because I haven't needed it for my own projects, but keep an eye on the hexus/phaser-slopes repo for new releases.

That plugin implements smooth collisions between contiguous tile edges for MatterJS, and may introduce the same functionality for Arcade Physics in the future too.

eliseubaldo commented 3 years ago

Hi, Just joining @SHG42 and expecting the Phaser 3 update :)

valueerrorx commented 3 years ago

hey @hexus - thank you very much for this plugin .. unfortunately it seems to have stopped working for phaser 3.54 any ideas ? thank you in advance :-) Peek 2021-05-24 21-05

hexus commented 3 years ago

Hi @valueerrorx. This plugin (phaser-arcade-slopes) is not Phaser 3 compatible. hexus/phaser-slopes is, however it implements smooth collisions for contiguous internal edges for Matter.js, not Arcade.

Basically, my above comments still stand. I haven't had the chance to work on these plugins in a long time.