Setting up Physics
GameStart physics are abstracted from the underlying physics API, the current backend is based on the most recent version of Bullet Dynamics.

5 minutes setup test (assets courtesy of François Gutherz).
1. Creating physics-controlled elements.
The most immediate use of physics is for creating dynamic elements that interact with each others in a physically believable way.
Setting up physics for an item is a two-step procedure:
- Specifying the item interaction model with the physics world,
- Creating the item collision shapes.
1. Physics interaction model.
An item can interact in 4 ways with the physics world:
- None: No interactions with the physics world (Default).
- Static: The item is an immovable entity with infinite mass, this is usually the case of the level geometry.
- Kinematic: Just as the Static mode but this item can be moved, this is one way to do lifts or doors.
- Dynamic: The physics engine is in charge of determining the motion of the item based on the physics events happening around it.
Note that both the Static and Kinematic modes are one-way only, items using this mode interacts on Dynamic items but are not affected by them.

An item physics mode can be selected using the Physics properties panel.
2. Creating collision shapes.

Item Physics properties panel.
Collision shapes usually are a coarser representation of an item geometry. They allow the collision engine to provide the physics engine with a set of contact points between physics-enabled items. Based on this set of contact points the physics engine can then take action to solve these collisions in a physically believable way.
Creating collision shapes is done using the Physics properties panel of an item after a physics-enabled mode has been selected. By clicking the Add... button in the Collision shape group you can create one of the following shapes:
- Box: An oriented box.
- Sphere: A perfect sphere (not an ellipsoid).
- Capsule: A Z-aligned capsule.
- Cone: A Z-aligned cone.
- Convex: A convex built from an arbitrary geometry. You can think of this shape as what would a large piece of tissue tightly wrapped around the geometry look like.
- Cylinder: A Z-aligned cylinder.
- Mesh: An arbitrary geometry.
Tips: You can quickly create a convex or mesh collision shape by drag'n'dropping a geometry (from the editor or the OS explorer) onto the item Physics properties panel.
You might very well think that since all physics-enabled items usually have a geometry representation on screen one could simply use that geometry as a collision shape and be done with it. This is, with a few exceptions, usually not done this way for several reasons:
- Performance: While GPUs are very good at pushing millions of triangles to the screen determining the set of contact points between two arbitrary geometries is a much more complex problem to solve.
- Technical limitations: Differentiating the "inside" from the "outside" of an arbitrary geometry (polygon soup) is a complex problem and most physics engine rely on this feature to correct penetrations occurring during the course of the simulation. For this reason among others a very few physics engine supports practical dynamic vs. dynamic geometry collision.
- Gameplay: Very often you might want to restrict the gameplay to a specific area of a geometry without having to have your artists put up big wall visuals at the boundaries of this area. Collision shapes allow you to specify a different collision configuration from the visual one.
Creating complex multi-shape physics bodies is shown in the Multiple Collision Shape tutorial.
3. The item physics properties panel.
Damping:
Lets you specify linear and angular damping for the item. Damping gradually reduces velocities over the course of the simulation. The net effect of this is to increase stability at the cost of realism. A small amount of damping usually does no harm but can quickly make items appear like they are "floating" in space.
Collision mask:
Lets you specify a couple of binary masks used to filter out collisions. The Collide With Mask specifies the groups this item can collide with and the Collision Group Mask specifies the groups this item belongs to.
Edit in View:
Lets you adjust the current collision shape selection directly from the 3d viewport using transformation gizmo similar to those of the normal scene edition.
Shape transformation:
Displays the transformation for the current shape selection.
Shape properties:
Lets you configure the physics properties of the current shape selection:
- Mass: How heavy the shape is. This value directly affects the interaction of the item with the rest of the physics world as well as the item center of gravity location.
- Static Friction: Opposes forces and resists against the item going from standing still to moving.
- Dynamic Friction: Opposes motion and tries to stop the item from moving.
- Restitution: Elasticity of the collision, a low restitution contact produces no rebound. A high restitution contact perfectly preserve velocities (incoming velocity = outgoing velocity at the contact point).
Note on mass-ratios: Most real-time physics engine (as is the case with Bullet) cannot handle large mass ratios very well unless a very high internal frequency is specified leading to an unmaintainable CPU load. Thus, games tends to keep the mass-ratio below 1 to 4 between the lightest and the heaviest interacting items in a scene.
2. Tweaking the simulation.
The physics engine runs decoupled from the display engine. It internally runs at a fixed timestep in order to achieve greater stability.
The simulation quality is directly affected by this timestep size. The more internal steps the physics engine can take, the more stable the simulation will be. A smaller timestep also prevents the tunneling effect which is the main cause of missed collision and objects passing through collisions.
The physics engine timestep can be configured by selecting the scene object in the scene explorer and using the Physics properties panel Frequency field. The physics frequency controls how many steps the physics engine can take per second. The default value of 75hz (75 steps per second) is enough for most standard configurations but a 200hz physics frequency is not uncommon for more involved setups.