1
votes

Why should you even use kinematic bodies instead of dynamic bodies with no gravity? I mean a dynamic body can also collide with static bodies and have some other adjustable parameters that kinematic bodies do not have, right. Therefore, I would really love to hear why you would want to do this and if it even can be lead to some advantages.

Your time is much appreciated!

1
Did you try using a search engine for the words "kinematic bodies"? Because the top results for me are blog posts discussing exactly your questionUnholySheep
Also the official docs says this: "Kinematic bodies are great for things where you, the programmer, want to be in full control of a body's motion, such as a moving platform in a platform game."UnholySheep
I have put a comment to Louis' answer, please take a look. Thanks, also for your comments :-)user7654188
I've seen the comment and it makes your question unclear - do you want to have the body in question have collision or not? If yes then you can't use a kinematic body, if no then using a dynamic body would be a waste (in terms of setup code) and potentially cost performance (a physics engine could handle updating of kinematic bodies differently since they have fewer constraints)UnholySheep

1 Answers

1
votes

It's a matter of what you want b2World::Step to do to the body. Basically this method's body related post-conditions are as follows:

  • Static bodies are unmoved.
  • Kinetic bodies are moved based on their previous velocities.
  • Dynamic bodies are moved based on their previous velocities, gravity, applied forces, applied impulses, masses, damping, and the restitution and friction values of their fixtures when they experience collisions.

So kinematic bodies can be useful when the only thing that you want to have happen to the body is to have it moved based on a velocity you'd given it.