Physics body types

The physics system needs to understand how to simulate physics for an object and how these objects will interact with others. The physics body type has great effect on this so it is important to select an appropriate type.

Static Bodies

Description: Static bodies are objects that do not move. They are unaffected by forces or collisions, and they do not have a velocity. Static bodies are typically used for objects that are part of the environment or scene and should remain stationary, such as the ground, walls, or other immovable objects.

Characteristics:

  • Immovable: Static bodies remain in a fixed position.

  • Unaffected by Forces: They do not respond to forces, impulses, or collisions.

  • No Dynamics: They do not have linear or angular velocity.

Usage Example: Static bodies are used for objects like floors, platforms, or boundaries in a game or simulation, where these objects should not move but can interact with dynamic bodies.

Kinematic Bodies

Description: Kinematic bodies are objects that can move but are not influenced by physics forces. Their movement is controlled by setting their velocity or position directly. Kinematic bodies are useful for objects that need to follow a specific path or animation, such as moving platforms or characters with scripted movements.

Characteristics:

  • Controlled Motion: Kinematic bodies are moved explicitly by setting their position or velocity.

  • Unaffected by Forces: They do not respond to forces, impulses, or collisions, but they can affect dynamic bodies through collisions.

  • Predictable Movement: Their motion is defined by the programmer or simulation logic.

Usage Example: Kinematic bodies are used for objects that need to move in a controlled manner, such as elevators, moving platforms, or NPCs following a path.

Dynamic Bodies

Description: Dynamic bodies are objects that are fully simulated by the physics engine. They respond to forces, impulses, and collisions, and their motion is determined by the laws of physics. Dynamic bodies are used for objects that need realistic physical behavior, such as characters, vehicles, and objects that can be thrown or pushed.

Characteristics:

  • Fully Simulated: Dynamic bodies are affected by forces, impulses, collisions, and gravity.

  • Realistic Motion: Their movement is determined by physics calculations, making them behave naturally.

  • Interactive: They can interact with other bodies (static, kinematic, and dynamic).

Usage Example: Dynamic bodies are used for objects that need to behave realistically in a physical simulation, such as balls and crates

Last updated