Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm making a game for Android with AndEngine.

It's going quite well, but now I'm stuck on something. My main character has a elasticity set in its fixturedef so it bounces around throughout the game. Now i want the user to be able to not let the player bounce when he does a control.

So my question: how can I modify the elasticity of my character? Because I saw you can adjust the setDensity and setFriction, but I cant see the setElasticity....

Thanks in advance!

share|improve this question
    
I also up vote your question because I also have to search for this thing. –  Siddharth Jun 9 '13 at 4:11
add comment

2 Answers

up vote 1 down vote accepted

Following way you can change the restitution or elasticity of any body in box2d.

ArrayList<Fixture> fixtureList = body.getFixtureList();
    for (Fixture fixture : fixtureList)
        fixture.setRestitution(0.5f);
share|improve this answer
add comment

This is because elasticity is expressed as a coeficient of restitution. Look for setRestitution (float restitution).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.