Question

I'm trying to create this trampoline/rubber band using box2d and cocos2d. I got to a point where in my head it should all just work except I don't get the expected effect. My trampoline looks like this:

enter image description here

  • the green objects and the blue one are static
  • the red dots represent distanceJoints between those objects with the following params:

frequency = 10.0 dampingRatio = 0.1

  • the brown objects have the following properties:

friction = 0.0 restitution = 0.3 density = 20.0

  • the blue object is a static object
  • the green lines represent distanceJoints with the following properties:

frequency = 4.0 dampingRatio = 0.5

  • the properties of the object dropped on the trampoline are these:

fiction = 0.0 restitution = 0.5 density = 100.0

The effect I'm getting using this configuration when I drop the object on the trampoline is more of a mattress drop effect, my object is bounced up once or twice but not by much and than it stops.

My questions are:

  1. Is this a good approach? How can I tweak this trampoline to behave more like a trampoline and less like a mattress?

  2. Once #1 is answered how can I make my blue dummy/ghost object not respond to any collisions and therefore be invisible/non existent as far as the user is concerned?

Thanks!

Was it helpful?

Solution

If you are getting the desired effect initially but then it fades away, it could be that the damping of the distance joints is just too high. That said, I don't think objects bounce up and down forever on a trampoline in real life...

To make a body be invisible/non existent you can set the fixture to be a sensor fixture, or se the collision filter bits to zero, or just not give it any fixtures in the first place.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top