Action Over Time Standards

v1.0

When an Action inherits from ActionOverTime or ActionOverTimeWithBaseValues, it is forced to be set up with standardized logic including the ability to select one or more targets from a list of one or more targets, with various target selection methods, and more.

Animation Curve

The value over time of the Action can be determined using an AnimationCurve, exposed in the Inspector. This provides a lot of control over how the Action feels in the end.

In the examples above, the curve is driving different movement behavior in MoveAction.

Action Targets

By default, the target list is empty, and the useTargetAsFallback bool is true. This means that if the ActionExecutor is on the object you're looking to target, you do not need to populate the value. The first time it runs, it will cache the fallback value.

circle-info

Depending on the type of target, the Action may attempt to find a fallback target in various ways. Camera targets will search for the main camera, for example. When this happens, the found target will be cached in the global Blackboard, so other Actions seeking the same fallback type will skip searching and use the previously found target.

It's generally faster to populate targets, though the system is designed to minimize expensive lookups.

In the examples below, there are 5 targets in the list, and the group that the Action is in is set to loop 10 times total, with 0.5 seconds between each loop. The duration of the Action is 1.0 seconds.

One or Multiple Targets

In each of these examples the Selection Mode is "Sequential". This first example has a single target selected. With each loop iteration, the Sequential mode selects the next target in the list.

One target, looped 10 times, selected Sequentially

Next we have 3 targets being selected. Once all targets have been selected, the first target in the list will be selected again. Since the loop duration is 0.5 seconds and the duration of the Action is 1.0 seconds, some targets are restarted before they complete their full animation.

3 targets, looped 10 times, selected Sequentially

In this example, we have 5 targets selected, meaning each time all targets will be included.

All 5 targets, looped 10 times, selection mode won't matter as all will be chosen

Selection Modes

You can choose how the system will select among the available targets.

Sequential

In this mode, each time the Action executes, either through a loop or multiple Execute() calls, the next target in the list will be chosen.

Random

Random will produce a different target each time β€” or the same multiple times in a row. If you're using the Deterministic Random, then each set of selections will be the same each play.

Random No Repeat

This mode will select a random target, but will ensure that each target in the list is selected once before choosing from the full list again.

When multiple targets are selected at once, as soon as the list has been fully selected, the next target will choose from the full list.

Selecting All Targets

To select all targets, set the Target Count value to be the same as the number of targets in the list.

Return to Base

ActionOverTimeWithBaseValue is a class which inherits from ActionOverTime. For Actions where the concept of a "base value" makes sense, this exposes the option to force a return to the base value at the end of the Action execution.

Here the curve goes from Y0 on the left (X0), towards the target value represented as Y1 at the end of the curve (X1). Because we have Return To Base set true, at the end the object snaps back to its base position.

The built-in logic for this gracefully handles restarts. If an Action is restarted before it has completed, the new instance will inherit the cached base value from the initial instance, and utilize its new starting point as part of the animation curve, smoothly interpolating back to the base value throughout the curve.

Last updated