Forge Dynamics Shape
Pro features are only available with a Professional licence. To upgrade, visit cavalry.scenegroup.co.
Intro
Forge Dynamics is a 2d physics engine built on the amazing Box2D by Erin Catto
It's possible to test Forge Dynamics with a Starter licence by using a Preset. Choose one via the Create > Demo Scenes > Dynamics menu. While it will be possible to experiment with the feature, saving and rendering will be blocked. See Licensing for more information.
UI
- Shape
- Mask
- Bodies
- Initial State
- Advanced
Start Frame - Set a frame for the simulation to start on.
Gravity - Set a strength for gravity.
Ground Mode - Determine how the simulation should react to the Composition boundary.
- Off - Ignore the Composition edges.
- Composition Bottom - Collide with the bottom of the Composition.
- Composition Edges - Collide with all edges of the Composition.
Ground Friction - Set a value to determine how much friction affects collisions with the Composition edges. A higher friction value will result in shapes losing their speed more quickly.
Velocity Iterations - How strongly to correct the forces applied to Shapes. The higher the value the more accurate the result.
Position Iterations - How strongly to correct the position of Shapes during collisions in order to reduce overlaps. The higher the value the more accurate the result.
Fields - Add a Field to the simulation.
Collision Events - Add a Collision Event to the simulation. Collision Events can also be added on a 'per body' basis via the settings under the Body tab.
Any Collision Events added to a Body will override Collision Events added to the Forge Dynamics Shape.
Bodies - Connect Shapes to be included in the simulation. Shapes can be added by dragging them into this attribute via the Scene Window, right click > Add Body > select Shape
or via a Connection Anchor.
The list of Bodies includes options to enable/ disable them, set specific settings or remove them from the simulation.
Per Body Settings
You can access 'per Body' settings via the cog icon within the list of bodies:
- Input Shape - The Shape being used as a Body.
- Friction - Set a value to determine the friction. A higher Friction value will result in Shapes losing their speed more quickly.
- Bounce - Set a value to determine how bouncy Shapes are. A higher Bounce value will result in Shapes bouncing higher/ further.
- Density - Set a value to determine how dense Shapes are. A higher Density value will give Shapes a heavier appearance and result in them requiring more force to move.
- Gravity Scale - Increase/ decrease the affect the Gravity attribute under the Shape tab has on Shapes. A value of
-1
would invert the Shape's Gravity setting or a value of2
would double it. - Body Type:
- Dynamic - Bodies will move based on the properties set for the simulation.
- Still - Bodies will remain in place and, while they will be included in collisions, their position or rotation will not be affected.
- Kinematic - A Body's position and rotation will be dictated by any keyframe animation on the Input Shape.
- Kinematic Hybrid - A Body's position and rotation will be dictated by any keyframe animation on the Input Shape until the last keyframe at which point it will join the simulation.
Only keyframe animation is supported for Kinematic Shapes. Procedural animation via Behaviours is not supported.
- Constrain Hybrids - This setting will attach a spring to the Hybrid Body so that when the it comes to the end of its animation it will spring to a stop.
- Hybrid Frequency - Set the frequency of the spring in Hz.
- Hybrid Damping - Set how quickly the spring comes to a rest. A higher value will result in less secondary motion.
- Sensor - A Sensor is a shape that can trigger collision events, but will not trigger collisions.
- Collision Shape Type - Set the shape to be used for collisions. These are set automatically using a 'best guess' but can be set manually. Simpler shapes can help improve performance for more complicated scenarios but will decrease the accuracy of the simulation. Collision Shapes can be displayed in the Viewport by selecting a Forge Dynamics Shape with Draw Debug Information enabled in the Viewport Settings.
- Box - Use the bounding box of the Shape.
- Circle - Use a circle that 'best fits' the Shape.
- Polygon - Use a polygon that 'best fits' the Shape. The polygon of up to a maximum of 12 sides can be used. If a 12 sided polygon can’t be used to approximate the Body then a box will be used instead.
- Chain - Use this setting for open contours/ paths. This is a one sided collision and finding the correct setting will depend on how the contour is drawn. As a guide - when selecting a contour with the Edit Shape tool, the side of the contour the little arrow indicating the direction appears on, is the side that will collide.
- Chain (Reversed) - Use this setting for open contours/ paths. When Chain is not working for a contour it's likely that it is 'upside down' and so being excluded from collisions. Try this setting in that situation.
The Chain Collision Shape Type is intended for use with open paths. Because open paths have no volume they can't have forces applied and so will always remain static regardless of their Body Type. While a closed Path can be set to Chain, the same principles apply.
- Live Forever - When checked, a Body is always included in the simulation.
- Lifespan - Set a duration (in seconds) after which the Body will be removed from the simulation.
- Starts Asleep - When checked, the Body will be dormant until another shape collides with it.
- Allows Sleep - When checked, a Body will be allowed to sleep when it becomes dormant. This can help performance.
- Starting Velocity - Set a velocity to be applied to the Body at the point it first appears.
- Starting Rotational Velocity - Set a rotational velocity to be applied to the Body at the point it first appears.
- Position Damping - Set damping for the Body's position. A higher value will result in faster declaration.
- Rotation Damping - Set damping for the Body's rotation. A higher value will result in faster rotational decelaration.
- Use Maximum Velocity - When checked, the velocity of all Bodies will be restricted to the Maximum Velocity.
- Maximum Velocity - Set the maximum velocity the Bodies can reach.
- Use Maximum Rotational Velocity - When checked, the rotational velocity of all Bodies will be restricted to the Maximum Rotational Velocity.
- Maximum Rotational Velocity - Set the maximum rotational velocity the Bodies can reach.
- Level Mode - choose which level(s) of a sub-mesh to affect. See Sub-Mesh for more info.
- Custom... - Manually set a Custom Level.
- Text (Lines) - Used with a Text Shape, this will affect each line.
- Text (Words) - Used with a Text Shape, this will affect each word.
- Text (Characters) - Used with a Text Shape, this will affect each character.
- All - Affects all sub-meshes, regardless of level.
- Custom Level - Manually set a custom level.
- Constraints - Add Constraints.
- Collision Events - Add Collision Events.
Global Settings
Use Maximum Velocity - When checked, the velocity of all Bodies will be restricted to a Maximum Velocity.
Maximum Velocity - Set the maximum velocity the Bodies can reach.
Use Maximum Rotational Velocity - When checked, the rotational velocity of all Bodies will be restricted to a Maximum Rotational Velocity.
Maximum Rotational Velocity - Set the maximum rotational velocity the Bodies can reach.
Initial Position Strength - Set a force to attract the Body back to its starting position. Keyframing this attribute can return Bodies back to their start position part way through a simulation.
Initial Rotation Strength - Set a force to attract the Body back to its starting rotation. Keyframing this attribute can return Bodies back to their start rotation part way through a simulation.
Starting Velocity - Set a velocity to be applied to all Bodies at the point they first appear.
- Starting Rotational Velocity - Set a rotational velocity to be applied to all Bodies at the point they first appear.
World Scale - Use this to adjust the world scale where there are very large or very small Shapes in the simulation to improve the simulation quality.
Time Step - Set how many times the simulation is stepped (calculated) per second. A higher value will result in higher quality simulation but may impact performance.
Cache Solver (button) - Cache the Forge Dynamics simulation. Cavalry will playback the Playback Range in order to save the cache file to disc. With a cache saved, this button will become an Update Cache
button. This will overwrite any existing cache in use.
Remove Cache (button) - Remove the saved cache file. This does not delete the .sdcache
file from the file system.
Use File Cache - When checked, the simulation can be saved to a .sdcache
file. This can be useful for faster playback with heavier simulations or for retiming via the Cache Offset. It is also required for Motion Blur.
Cache File Path - Set the location the cache file is saved. This is determined when first caching a solver or use the folder icon to open a Finder/ Explorer window and navigate to an existing .sdcache
file.
Cache Offset - Set a time offset for the cache.
You can use the cache to 'rewind' a simulation and create a loop if required. To do this:
- Cache the simulation.
- Set a keyframe for Cache Offset just after the simulation ends.
- If, for example, that keyframe was set on on frame 100 then move the playhead to frame 200 (e.g. forward another 100 frames) and then add a keyframe with a value of -200.
By setting a keyframe at frame 200 with a value of -200 you are effectively asking the cache to show you frame 200 + -200
which = 0
. e.g. The cache is back to frame 0 (the start).
The table below illustrates how the Cache Offset creates the loop back to frame 0.
Frame | Cache Offset Value | Equivalent Value |
---|---|---|
0 | 0 | 0 |
100 | 0 | 100 |
200 | -200 | 0 |
It's not possible to update the geometry of a Shape during the simulation. For example:
- Animating Scale.
- Animating the attributes of primitive Shapes (e.g. the Width of a Rectangle or the Radius of an Ellipse).
- Animating vertices (aka Path Animation).
- Using Deformers.
- Animating Shapes like Convex Hull or Connect Shape.