# Box 2D Collision Question

I am very new to Box 2D Physics world. I wanted to know how to collide 2 bodies when one is Dynamic and other is Kinematic.

The whole Scenario is explained below: I have 3 balls in total. I want to balls to remain in their places and the third ball to be able to move. When the third ball hits the other two balls then they should move according to the speed and direction from which they were hit. My gravity of the world is 0 because I only want z-axis gravity.

I would also like some one to point me towards some good tutorials regarding Box 2D basics which is language independent.

I hope I have explained my scenario well.

Thanks for the help in advance.

-

Kinematic bodies aren't really suited for this. The idea of kinematic bodies is that you move them instead of letting the physics-engine dictate the movement. But this is apparently not what you want.

I would create all your bodies as dynamic, but use joints (for example the Weld-joint) to fix the 2 static balls in place. Then whenever you register a collision on one of the fixed balls, break the joint (using `DestroyJoint`).

-
Thank you for the reply. Basically I need one of the balls to be moved by player it self. I have a rotation angle and a slider through which user will give power and angle. and the ball will move accordingly, and if hits the other two then they act according to the angle and the force implied on them by this ball. I hope it makes sense. Please suggest what should be the type now. and if you could point me out to some reference example that would be great. Thanks. – Farooq Arshed Jul 9 '12 at 5:50
@FarooqArshed First, you would have no ball in your physics-simulation. Just the visual representation of it and handles to adjust force/angle. Once the player sets these values add a dynamic physics body to the world and apply this force and angle to it. The fixed bodies should be as described in my anser (dynamic but welded in place using joints). I don't know what programming language you use, but a google search should turn up tons of Box2D examples/tutorials. – bummzack Jul 9 '12 at 6:39

You should look at this tutorial if you are just starting with box2d. It will really help you :)

-
Thanks. I will surely look into it. – Farooq Arshed Jul 7 '12 at 22:05
A link alone isn't really an answer as it will become worthless when the link disappears. Also this doesn't help with the problem at hand. – bummzack Jul 8 '12 at 9:48