schteppe / p2.js

JavaScript 2D physics library
Other
2.64k stars 330 forks source link

How to implement these 2 cases in dyn4j #282

Closed finscn closed 7 years ago

finscn commented 7 years ago

I think dyn4j is the best Physics Engine ( http://www.dyn4j.org/ )

There are 2 cases I don't know how to implement with P2.js , please help me, thanks .


the First :

2017-02-05 2 31 17

It's named 'pulley' in dyn4j's demo . When Left Box down, the Right up.


the Second :

2017-02-05 2 34 45

The key is 'y' .
The top part of 'y' could collide with everything , but bottom part doesn't.

Thanks.

schteppe commented 7 years ago

Ok, the 1st is a Pulley Joint, which is not available in p2.js (yet). You could try using 2 distance constraints and manually adjusting the lengths of them - it won't be as good as a pulley joint but it may be enough for your use case.

The 2nd one could be done by making the Y using 2 shapes, and disabling collision on the bottom shape. Or you could just skip adding the bottom part of the Y to the physics, but still render it.

finscn commented 7 years ago

Thanks.

The last question: Which features that dyn4j & matter-js supported ,but p2 doesn't ?

schteppe commented 7 years ago

That one I cannot answer... I haven't used dyn4j or matter-js. Would be cool to see a compiled list of features supported in the three engines, side by side.

finscn commented 7 years ago

Thanks :) And please forgive me for my junior & stupid questions, I'm a newbie of p2

finscn commented 7 years ago

Hi @schteppe , the Pulley Joint is in your Plan ? And is there a roadmap of p2.js ? This is an amazing project , I hope it could be continue.

schteppe commented 7 years ago

Hi again. Pulley joint would be a natural step forward for p2.js. There is no roadmap, but I guess it would be cool if all features in box2d were in p2 too. It's just a hobby project and I don't work on it regularly. Help is appreciated!