简体   繁体   中英

Why even use kinematic bodies? box2d

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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM