Dynamically Disabled Collision Responses (Hacking Box2d)

Yes. Your angled platforms fall well within the 120 degree range I've set by default.

I've updated the code above to be able to safely handle an arbitrary solidity angle range. I've tested it with all four cardinal directions on a bunch of polygons and a big circle. Interestingly, you can use this approach to create a convex arc.

I also fixed a small bug in my demo code above by checking normals on Persist as well as Add which caused platforms to sometimes remain solid at angles which they shouldn't. (I haven't fixed this in the demo SWF, however.)
Thanks Chriswa, I will try it. I just need to know which code did you update specifically. Just the b2ContactListener or also changes to core?
Just my example code in TestPlatformsContactListener. The only change needed to Box2D is adding the b2Contact to ContactListener calls.
Here's a little tech demo of platforms in their native habitat (a platformer game). I'm using shaktool's thin line segments ( viewtopic.php?f=8&t=1437 ) and am building my levels in SVG with Inkscape (also thanks to shaktool.) I'm still stuck on how to do concave platforms.

Arrow keys to move, up is jump:

http://www.swfcabin.com/open/1227392864

I know it's far from perfect. I have the infamous "sliding" problem and probably a lot more.

P.S. No sensors were harmed (or even used) in the making of this tech demo.
Hey guys,

For those who have had a problem patching Box2D with chriswa's unified context files

http://www.swfcabin.com/open/1227464194 -Check it out here. Just toss the ball around.

http://www.blurrycode.com/Box2D-PlatformerHack.rar All of the Box2d files modified for two way platforms. Any code that was changed is commented with //chriswa.

If you're adding a platform shape add this to its shape def .userData = "platform";

If you're adding a a shape that will interact with these platforms add this to its shape def .userData = "creature";.
Hmmm.. Chriswa, have you noticed that sensors behave wierdly? I am noticing that the collisions of sensors is broken "sometimes" with this update...
Yes, I think the problem is with Remove(). It's supposed to revert contacts to solid after the last contact point is removed, but it also makes sensor contacts solid. That's the problem you're experiencing, right?

My solution was to add a Dictionary to ContactListener called disabledContacts and keep track of contacts I disable, then in Remove, only "re-enable" contacts which were previously disabled. Then it's as simple as skipping nonSolid contacts so they never get disabled -- or re-enabled.

I may post some more code soon, but currently everything is tightly coupled with my platform engine.
Thanks for the platform hack chriswa. This works great for platforms and one-way down doors.

I am looking into creating a one-way door that works in other directions. Any ideas on where to modify your code (ContactListener I imagine) to allow for different angles? Thanks again.
chriswa wrote:
Just my example code in TestPlatformsContactListener. The only change needed to Box2D is adding the b2Contact to ContactListener calls.


Anyone know how to do this?

Thank you!

Original thread: https://box2d.org/forum/viewtopic.php?t=1748