Keeping a body (balloon) upright by correcting its angle?
Posted: Fri Dec 03, 2010 5:09 am
Hi,
I am trying to make a body correct its angle, because I want to give the effect of it keeping itself upright, the body is presented as a helium balloon that can bounce off walls.
I apply an upward impulse to the balloon to give the effect of being lighter than air. I have tried keeping it upright by damping the angle as follows:
float angle = body.getAngle();
angle *= 0.75f;
body.setAngle(angle);
It works ok but not fantastically.
Excuse the Java, I have made some Java bindings for chipmunk but you get the idea.
I also tried adding a PinJoint constraint and attaching a body with more mass to the bottom of the balloon but the effect was undesirable since it would bounce and loop around as if it was anchored, as one would expect.
Can someone with more experience advise me of a better way.?
Thanks in advance and thanks for such an awesome physics engine!
I am trying to make a body correct its angle, because I want to give the effect of it keeping itself upright, the body is presented as a helium balloon that can bounce off walls.
I apply an upward impulse to the balloon to give the effect of being lighter than air. I have tried keeping it upright by damping the angle as follows:
float angle = body.getAngle();
angle *= 0.75f;
body.setAngle(angle);
It works ok but not fantastically.
Excuse the Java, I have made some Java bindings for chipmunk but you get the idea.
I also tried adding a PinJoint constraint and attaching a body with more mass to the bottom of the balloon but the effect was undesirable since it would bounce and loop around as if it was anchored, as one would expect.
Can someone with more experience advise me of a better way.?
Thanks in advance and thanks for such an awesome physics engine!