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 not quite sure what I need to do, but I have a ball falling from the sky and it needs to bounce when it hits an object. Do I configure the ball in some way or do I need to setup a spring object or possibly do something on collision?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

I figured it out. Requires a bit of tweaking but it works as I expect.

Body ball1 = PrefabBodtFactory.CreateBody(PrefabType.Ball, _world, new Vector2(3.8f, -0.75f));
            ball1.CreateFixture(new CircleShape(0.25f, 0.5f));
            ball1.FixtureList[0].Restitution = 1f;
            ball1.ApplyLinearImpulse(new Vector2(0.1f, 0));
            _bodies.Add(ball1);
share|improve this answer
    
Care to mark this as the answer? –  Jonathan Hobbs Aug 21 '11 at 1:46
1  
@Jonathan Hobbs: He has to wait at least 2 days (I think) to do that. –  bummzack Aug 21 '11 at 12:06
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.