0

I am doing a game with cocos2d and using chipmunk to manage the physics. What I would like to achieve is what pretty much every nintendo game does that your character may jump and rest in a higher floor (collision shape) without causing a collision as long as the velocity is positive, and that once the velocity is negative the collision does happen.

Basically I want to condition the collision between 2 shapes based on the velocity value. Could anyone please point me in the right direction on how to implement this?. Thank you.

-Oscar

Oscar Gomez
  • 18,436
  • 13
  • 85
  • 118

2 Answers2

1

The latest version of Chipmunk has better support for collision events and has a simple demo showing how to implement one way platforms.

slembcke
  • 216
  • 1
  • 1
0

I'd just implement per-pixel collision-detection as normal, but add your additional condition: if the velocity has a upward component, ignore the collision.

Community
  • 1
  • 1
John Feminella
  • 303,634
  • 46
  • 339
  • 357