Skip to content

Using Matter.js as physics engine #2659

Answered by eonarheim
justinfernald asked this question in Q&A
Discussion options

You must be logged in to vote

@justinfernald This should be possible to do!

I haven't attempted this yet (I'll have some time later this week), but the approach I'd try is using Excalibur's ECS:

  1. Build a custom ECS System to host the matter.js code Engine/World and run the simulation. It looks like matter.js supports manually running thesimulation.
    a. Here is a simple-ish system in the docs https://excaliburjs.com/docs/systems/#implementing-your-own-components--systems

  2. Create new a new ECS component type to wrap the matter.js Body/Constraints. When this new component is added to an Excalibur actor that matches a system's types it notifies the system. This notify mechanism in the new system is where you could wire i…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@eonarheim
Comment options

@justinfernald
Comment options

@eonarheim
Comment options

Answer selected by justinfernald
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants