0
\$\begingroup\$

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?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

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);
\$\endgroup\$
2
  • \$\begingroup\$ Care to mark this as the answer? \$\endgroup\$ Aug 21, 2011 at 1:46
  • 1
    \$\begingroup\$ @Jonathan Hobbs: He has to wait at least 2 days (I think) to do that. \$\endgroup\$
    – bummzack
    Aug 21, 2011 at 12:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .