Tiled and collision

68 views
Skip to first unread message

Tom

unread,
Oct 29, 2018, 1:56:48 PM10/29/18
to excaliburjs
At the moment the Tiled plugin doesn't do collision out of the box, I was looking into this until I was wondering. What is the best way to create these collision boxes? Do you create invisible actors or is there a special Collisionbox type?

Erik Onarheim

unread,
Oct 30, 2018, 7:28:49 AM10/30/18
to Tom, excaliburjs
Hi Tom,

Correct, right now adding invisible actors with a fixed collision type on top of the TileMap is probably your quickest option to get full collision support with minimal effort.

Maybe something smilar to this 
CodePen Example


Depending on how far you want to go this could be implemented as a full feature in the current Excalibur physics systems.

To interact with the current physics system, you need to use a physics Body and/or CollisionArea. 

* The body is used for calculating physical position, motion, rotation, and, acceleration before/during/after a collision
* the collision area defines the collidable geometry and how to know if 2 geoms are colliding.

The approach I was planning on taking to add full featured collision support to TileMaps to excalibur:

* Carve a TileMap into a set of convex polygons and create a set of collision areas for them (our collision algorithm SAT only works on convex shapes), technically each tile is a rectangle so a first pass at implementation may just create collision area for each tile, it may be possible to then merge those.
* Refactor Body to not be coupled with actor, but to instead allow interfaces around these properties so that physics Body can be applied to anything
* Refactor Body to allow multiple CollisionAreas at a time or make a meta CollisionArea that is composed other collision areas (THIS WOULD BE A HUGE WIN), this will require a change in CollisionContact & DynamicTreeCollisionBroadphase to support treating multiple areas as 1 collidable object
* If CollisionPairs and CollisonContacts are generated correctly, it should just work.

It's a bit of a chore, and definitely is on our roadmp https://github.com/excaliburjs/Excalibur/issues/626

Apologies on this feature gap! Let me know if there is an issue with the workaround above, or if you want to tackle this feature.
Erik



On Mon, Oct 29, 2018 at 12:56 PM Tom <stroob...@gmail.com> wrote:
At the moment the Tiled plugin doesn't do collision out of the box, I was looking into this until I was wondering. What is the best way to create these collision boxes? Do you create invisible actors or is there a special Collisionbox type?

--
You received this message because you are subscribed to the Google Groups "excaliburjs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to excaliburjs...@googlegroups.com.
To post to this group, send email to excal...@googlegroups.com.
Visit this group at https://groups.google.com/group/excaliburjs.
To view this discussion on the web visit https://groups.google.com/d/msgid/excaliburjs/37d2ce53-77d4-48a2-a406-4ab919b99ec6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tom

unread,
Oct 30, 2018, 7:53:35 AM10/30/18
to excaliburjs
Thanks for the response, very interesting!

My current implementation will be something with just making the tiles blocking. Grouping them together etc will be a bit over my head ;-)

I'm also on vacation for two weeks so my dev time will be almost zero ;-(

Still thanks for the idea on how to implement!

Kind regards,
Tom

Op dinsdag 30 oktober 2018 12:28:49 UTC+1 schreef Erik Onarheim:
Reply all
Reply to author
Forward
0 new messages