Story Machine supports Box2D physics for rigid bodies, joints and constraints, and collision detection. Physics support in Story Machine is early, and more features will be exposed over time.

In Story Machine, some game objects may be part of the physics simulation, while others are not. Marking an object as part of the physics simulation requires adding a Physics component (see below) to that object. Even objects that do not move, such as walls and floors, must have Physics components in order to interact and collide with other physically simulated game objects.

Box2D’s documentation is a good reference for understanding core physics concepts and how they work together in a 2D physics system. Some features (joint motors, mouse joints, etc) are not yet exposed in Story Machine.

Adding Physics to Game Objects

All objects that participate in the physics simulation must have a Physics component. This component specifies how the object should be simulated. Nearly all physics objects will also need a Physics Shape component, which specifies the shape and mass of the object (circle, rectangle, etc). A single Physics game object can have multiple shape components, either on the same game object or as child game objects. Therefore it is possible to create complex objects out of basic shapes that are all simulated as a single physics object.

Constraints and Joints

A Physics Constraint component allows physics objects to be linked together with a joint or constraint. For example, objects representing individual links in a chain could be connected with a Distance constraint, one after another, to create a complete chain.

Applying Forces

Forces and impulses can be applied to physics objects using the Physics action. Impulses are instantaneous inflections of velocity or angular velocity, while forces apply a steady push.

Preview

This is an early preview of physics in Story Machine. Many more features, including more constraint types, collision detection events, and customizable gravity will be added in a future version.