Hey guys.
I'm trying to create a jack in the box using Box2D - I thought it would be rather straight-forward, but, seems I was wrong, heh.
I'm using the latest trunk version of Box2D so I have access to the soft-weld joint; I used it to create a vertical cantilever which mimics a loose metal spring with a heavy weight on top - this seems to work nicely to create the effect of the spring bending around after it pops out.
The issue I'm having is how to get it to "pop" out of the box. Basically, I'm not doing it like it would be in real life (the object & spring pushing against the top of the box); the box is a solid static box which creates the spring & weight (all of them don't collide with each other) when it pops open. I can't seem to make it actually "pop out" and push against the objects that are resting on top of it though.
My current "best" attempt is to create the objects as they are in pop-up state, then set the transform of the spring pieces & the weight inside the box.. but that doesn't have the effect of popping the weight up over time; on the first Step it simply pushes all of the chain pieces up and doesn't really apply the "velocity" I'm looking for.
Anybody done this before and might have some insight?
-P
I'm trying to create a jack in the box using Box2D - I thought it would be rather straight-forward, but, seems I was wrong, heh.
I'm using the latest trunk version of Box2D so I have access to the soft-weld joint; I used it to create a vertical cantilever which mimics a loose metal spring with a heavy weight on top - this seems to work nicely to create the effect of the spring bending around after it pops out.
The issue I'm having is how to get it to "pop" out of the box. Basically, I'm not doing it like it would be in real life (the object & spring pushing against the top of the box); the box is a solid static box which creates the spring & weight (all of them don't collide with each other) when it pops open. I can't seem to make it actually "pop out" and push against the objects that are resting on top of it though.
My current "best" attempt is to create the objects as they are in pop-up state, then set the transform of the spring pieces & the weight inside the box.. but that doesn't have the effect of popping the weight up over time; on the first Step it simply pushes all of the chain pieces up and doesn't really apply the "velocity" I'm looking for.
Anybody done this before and might have some insight?
-P