Confused by All Godot Physics Objects?

The Godot game engine has a number of objects which seemingly overlapping functionality such as Area2D, StaticBody2D, RigidBody2D and KinematicBody2D. And then in addition to this you would normally work with CollisionShape2D or CollisionPolygon2D. It can become a lot of wrap your head around.

Godot already has a great introduction to these concepts here. I will not try to repeat all the useful information written there, but instead give a practical sense of when you use a particular kind of object and help you remember which one is which.

Kinematic Body and Area

If we consider a typical 2D platform game then the the following objects would likely be a KinematicBody2D or a Area2D:

  • The player character. The hero if you will.
  • The enemies or mobs, trying to take the player.

Basically stuff that moves around with some kind of intelligence.

The word Kinematic should give a clue to anyone who remembers some of their high school physics. Kinematics is the study of motion only concerned with acceleration, velocity and position. It ignores forces and mass.

You cannot apply forces to a KinematicBody2D, but it contains methods for performing movements in relation to collisions. E.g. you can perform sliding along a collision surface, ask Godot to test whether a movement along a particular vector would cause a collision.

You could have your hero character be an Area2D because it can deal with collision but it does not really represent a physics body. A physics body is some solid object with mass which has a position and moves. An Area2D in contrast is more generic in nature and can simply mean an area in your game. E.g. perhaps you want something to change or happen once players enter a particular area on the map. Maybe a trap should be triggered e.g.

However since an Area can be moved around manually it can in principle be used as a game character as well.

Static Body

In a typical game, StaticBody2D would represent walls, ground and other unmovable objects. The reason for its existence is typically for performance reasons. While you could make walls out of kinematic bodies or rigid bodies as well, it would just give bad performance.

A game engine can more quickly figure out collisions for objects which are not moving.

Area2D is not well suited for this purpose because it does not represent a physical body. It it is not made to deal with things like making rigid bodies hitting it bounce, or kinematic objects slide along it.

Rigid Body

Rigid bodies are physical objects that move. They are called “rigid” in physics because they don’t deform in any way. They are completely rigid. Why do we care? Physicists care because such bodies are much easier to simulate. A wobbly object e.g. would be very hard to calculate the movements of.

In games rockets, bullets, rolling balls or collapsing walls in physics games such as Angry Birds would be rigid bodies.

Rigid bodies are very flexible since they can be put into different modes. You can turn it into a static body or kinematic body e.g. when needed.

Why may that be useful? Consider the Angry Birds game. When you are aiming the bird to fire, you likely want the bird to move entirely by code. In this case you want it to behave as a kinematic body.

However as soon as the bird is fired, all its movements and behavior is determined by physics alone such as force, collisions, mass, velocity etc. Thus as soon as the bird is catapulted out of the slingshot you can change the mode to a rigid body.

Geek dad, living in Oslo, Norway with passion for UX, Julia programming, science, teaching, reading and writing.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store