Cocos2D-JS Chipmunk: One-way platforms?

Discuss new features and future development.
Post Reply
jem
Posts: 1
Joined: Tue Apr 28, 2015 2:45 pm
Contact:

Cocos2D-JS Chipmunk: One-way platforms?

Post by jem »

Hello!

I've started using Cocos2D-JS to port my ObjC/Box2D game. I had to drop B2D and start using Chipmunk. It's great so far. Only thing I can't implement properly is the one-way platform.

Say body "A" is the platform and body "B" is the player. The preSolve phase allowed me to check that:
- B's lowest vertex is at least higher than A's topmost vertex.

This no longer seems possible since it seems (and I most certainly have missed something!) that Box2D provides the source position of both bodies and Chip provides the target position.

n.b. I've found the Unity tutorial https://chipmunk-physics.net/unityDocs/ ... neway.html and hoped it would work the same with the JS version. Apparently it doesn't seem to work the same (or I just missed something obvious) as I'm always returned the number 1 for the following:
arbiter.getNormal(0).y

Guidance to properly implement this is very welcome :-)

NB my "solution" so far is to make sure that body B hasn't gone deeper than 10% of its height below body A's surface. Works for low-speed objects. High-speed ones just go through most of the time.
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests