Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This physics does not have to be very complex at all.

There are a number of rectangles and one ball, all of which have the appropriate bounding volumes constrained to them, it would be great if the ball could knock them over and they in turn could knock into each other.

What is the most basic way of doing this?

share|improve this question
Adding two questions about the same topic in a row is not constructive. Please remove one of them and ask whatever you need to ask in the other. – aaaaaaaaaaaa Feb 4 '12 at 9:23
they're two different questions, if you don't like them, you can vote to close them. – SirYakalot Feb 4 '12 at 13:11
Do you mean cubes, not rectangles? Rectangles are twodimensional. – jcora Feb 4 '12 at 13:25
But they are so dependent that an answer to one is almost certainly going to deprecate an answer to the other. I don't want to be a pissed mod, it's just that you in general will get far better answer and waste less time by stating your question as one. If you have decided to use Bullet then this question is already outdated. – aaaaaaaaaaaa Feb 4 '12 at 13:29
ok, fair enough. – SirYakalot Feb 4 '12 at 13:51
up vote 1 down vote accepted

The scenario you describe is already complex enough that I would strongly recommend using an external physics engine. I can't think of any other way of implementing this that I would personally consider as being simple.

The good news is that integrating a physics engine into your game - if done early on - is usually a very straightforward process.

Details will obviously vary from engine to engine but in most of them it consists of:

  1. Instatiating a World object which will manage the simulation
  2. Associating a Body object with each of your game objects, and adding them to the world.
  3. Updating the World and drawing each game object using the information from their Bodys.


So if for instance, you had a class like this:

class GameObject
    Vector3 position;
    Quaternion rotation;
    Model model;

    void Draw()
        model.RenderAt(position, rotation);

You could replace the transforms information in your object with that of a physics body instead:

class GameObject
    Body body;
    Model model;

    void Draw()
        model.RenderAt(body.Position, body.Rotation);

Of course when creating the Body you'd need more information about its shape and behavior, e.g. you could specify the shape of the body using the model's bounding box.

Then it's just a matter of registering the bodies in the world and updating it.

// Register bodies in world
foreach(var gameObject in gameObjects)

// Update world
share|improve this answer
Thank you for this honest advice, I'm going to try and implement an external engine. – SirYakalot Feb 4 '12 at 13:12

Your Answer


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.