Skip to content
N8n5h edited this page Apr 4, 2021 · 22 revisions

Physics

Sections

Introduction

Armory is designed to work with any physics engine. Internally, a glue code is written which binds the physics simulation. This lets you pick the most suitable physics engine depending on project needs and makes Armory future-proof.

If no rigid body is detected in the scene, Armory skips including the physics module to save space and performance. To force the physics module, set Armory Project - Modules - Physics from Auto to Enabled.

By default, Armory is configured to use a full featured Bullet physics. If lighter engine is sufficient, Oimo physics is provided. With Oimo, triangle mesh shapes are approximated using convex hulls.

To pick active physics engine, set Armory Project - Modules - Physics Engine property.


Rigid bodies

A rigid body is a type of body that can be used to simulate physical interactions between solid bodies.

Rigid body demonstration

To start using rigid body simulations in Armory, they have to be enabled for Blender first. To do so, simply select the object that will interact in the physic simulation, then go to the Physics properties tab, on the Properties editor, and click on the Rigid Body button.

Enabling rigid body demonstration

If you hit Play (default F5), the object should be immediately free falling out of view:

Free falling demonstration

If this doesn't occur for any reason, you may want to give the troubleshoot section a look.

Types of rigid bodies

Dynamic

Fully simulated physical interactions with other rigid bodies. They are affected by gravity by default.

Static

Objects that don't move during physical interactions with dynamic or kinematic rigid bodies. Not affected by gravity whatsoever.

Kinematic

Objects that are controlled and animated during physical interactions. They are not affected by the physical simulations themselves, but can affect other rigid bodies.

Rigid body configuration

After you click Rigid Body, you will notice that an array of options will appear. These options allow configuring rigid bodies and are explained in details below:

Type

Allow controlling the type of the rigid body when exporting.

  • Active makes the rigid body to be exported as Dynamic if Animated is disabled.

  • Passive makes the rigid body to be exported as Static if Animated is disabled.

Settings

Mass

How much the rigid body "weighs". Important for simulations where more realism is expected, like realistic car movement using vehicle physics.

Dynamic

Controls whether the rigid body is Static when exporting. If disabled, rigid body will be exported as Static instead of Dynamic if Animated is disabled.

Animated

Controls whether the rigid body is exported as Kinematic.

Collisions

Shape

Definition of the shape of the rigid body for the physical simulations. Can be either a primitive: Box, Sphere, Capsule, Cylinder, Cone, which are much better for performance, or Mesh or Convex Hull which are more precise on the shape.

Visual representations of primitives in Blender:

Box Sphere Capsule Cylinder Cone

Non-primitives don't have a visual representation in Blender, but they are mostly based around the original mesh. For convex hull, a new mesh is generated at runtime which is a simplification of the original mesh, and it may look like something like this more or less, at least its outline:

Unlike convex hull, for mesh there is no simplified custom mesh generation, so it's imperative that you create a simplified and maybe even low poly version of the original mesh, to avoid major performance drops.

We can observe the difference between convex hull and mesh by just running a simple physical interaction test:

Mesh Convex hull

Basics of moving a rigid body

RigidBody API explained


Static bodies

Creating a static body


Trigger bodies

Creating a trigger body


Raycast


Physics World


Vehicle body


Soft bodies

Creating a soft body


Cloth simulation

Creating cloth simulation


Common pitfalls / troubleshoot

Wrong scale may break simulations

Make sure your Blender objects that interact in physics simulations always have scale of (1.0, 1.0, 1.0) inside of Blender. Rotation and location may be arbitrary.

How to check scale and rotation in blender

You can always apply the scale from within Blender by selecting the object, opening the Object menu entry and then navigating to Apply and then clicking on Scale, or simply hitting the shortcut Ctrl + A and then hitting the s key or simply selecting the option from the floating menu.

location of apply rotation and scale option

Clone this wiki locally