Unity and Cinemachine — The Orbital Transposer Body Option
A closer look at the Orbital Transposer
Continuing our deeper look at the options for a virtual camera when it is set to Follow another object, today we’ll be examining the Orbital Transposer option.
The Orbital Transposer option is much like the Transposer option, but it adds a couple of new features.
The first addition is that of Heading. Heading is the direction in which the target is either moving or facing. With the Orbital Transposer option, the virtual camera will attempt to position itself so that it points in the direction of the Heading.
The other addition is allowing the player some control over the virtual camera’s position. The player can be allowed, through proper configuration of the X Axis fields, to move the virtual camera along an orbital path around the followed target.
The Transposer Options
Before we get to any of these new options, we first see all of the same options that were available to the Transposer.
Here we see again the Binding Mode, Follow Offset, and various Damping options. Check out my earlier article to get a rundown on all of these settings.
For the Heading fields, the first thing to determine is the Definition. The Definition represents in what way the Heading is determined. For this we have four available options:
- Position Delta: Determines the Heading based on the difference in the position of the target since the last update.
- Velocity: Determines the Heading based on the velocity of the target’s Rigidbody component. If the target has no Rigidbody, this will function the same as Position Delta.
- Target Forward: Uses the target’s Forward axis as the Heading.
- World Forward: Uses a constant world-space Forward as the Heading.
Depending on which option is chosen for the Definition, we will then have either one or two additional options.
If Position Delta or Velocity is selected as the Definition, we get the Velocity Filter Strength field. This field controls the level of smoothing of the velocity of the virtual camera.
For any Definition we get the Bias field. This field determines the angular offset in the orbit in which to place the virtual camera relative to the Heading. This would be used if you wanted the virtual camera to not be directly behind the Heading by default.
As stated earlier, the Orbital Transposer gives us the opportunity to give the player some control over the virtual camera. This is mainly represented in the X Axis section. Here are the options available for this section:
- Value: This field represents the current value of the axis, in degrees.
- Value Range: These fields represent the minimum and maximum values possible for the axis, in degrees. This allows us to set boundaries on how much the player can move the virtual camera. There is also a Wrap field, which if selected will cause the virtual camera to wrap around when going beyond the min or max values of the range. Take note of this field if you plan on constraining the value range — doing a wrap around when the min and max are not aligned is very jarring.
- Speed: There are two fields to this setting. The drop down field has two options — Max Speed and Input Value Gain. Max Speed places an upper limit on how fast the player can move the virtual camera, and the numerical field represents that upper limit. Input Value Gain multiplies the input value by the value in the numerical field.
- Accel Time and Decel Time: These fields set limits on how quickly the player can accelerate to max speed or decelerate to zero.
- Input Axis Name: This field represents the name of the axis that controls the virtual camera, as specified in the Unity Input Manager. We can find the Input Manager within the Project Settings, which can be found in the Edit menu. This allows us to set exactly what input controls the virtual camera. For example, we can specify which keyboard keys or controller sticks act as input for this purpose.
- Input Axis Value: The numerical fields represents the value of the input axis. There is also a field Invert that allows us to reverse the value of the input axis.
Also related to user input are the Recenter To Target Heading fields. This section can be used to have the virtual camera return to its default position when user input is no longer being received. Here are the fields for this section:
- Enabled: When selected, this field enables the recentering feature.
- Wait Time: This field determines how long the virtual camera will wait without user input before recentering.
- Recentering Time: This field represents how quickly the virtual camera will recenter itself.
That wraps up our look at the Orbital Transposer option. We will continue examining the Body options next time with a deeper look at the Tracked Dolly option. Thanks for reading.