Runtime Parameter
Overview
The runtime parameter (RTP) window allows you to link parameters from the game with internal component properties.
Parameter
The RTP parameter area allows setting which property a parameter will control. It is possible for a parameter to have a seek value that defines the amount of time it will take to reach the target value, speed which moves it continuously in one direction and loop type that determines if the parameter that has speed will loop when it reaches the end.
Property
The graph defines the mapping between the input parameter and the property that will be changed. Just like the timeline it is possible to add/delete points in a graph, change the curve line between points (i.e. linear, log, exp etc)
Curves
It is possible to get access to the distance value between the component and the camera if you type “Distance” in the parameter name. This way it is possible to control any of the component properties using the distance parameters.
Runtime Parameter build in types
In this version of Fabric it is possible to control a parameter in different ways:
- User_Defined: Parameter has a name that the game can use to set a value
- Modulator: Parameter can be modulated using the new RTPModulator effect
- Volume_Meter: Any volume meter can link its RMS output with the RTP
- Distance: The distance between the listener and parent game object
- Component_Angle: The angle between the component and the listener or camera
- Component_Velocity: The velocity of the event game object
- Listener_Angle: The angle between listener and the component. Ideal for create simple culling processes that focus the audio to what the camera sees.
- Listener_Velocity: The velocity of the listener
- Custom_Parameter: Calls a callback function registered by the game that returns a value
- Random: Sets the parameter value at a random point within the min/max range on PlaySound event action
- Max_Instances: Sets parameter according to the number of active instances relative to the "Max Instances" property
Markers
It is possible to add markers on Runtime Parameters and timelines making it possible to set a parameter using the marker name.
To add a marker you enter a text and click on the add button. It is also possible to delete, rename, set the position of the marker (normalised for now) and enable its KeyOff support. When a maker is set in KeyOff mode it will stop the parameter cursor moving past (assuming it has speed) unless the EventAction.KeyOff is posted.
RTP Modulators
The Runtime Parameter modulator is a basic signal generator that can be used to drive runtime parameters. There are a number of options and type of signals available, such as:
Type: The types of different signals Sine, Square, Sawtooth, Triangle
Frequency: The signal frequency [0-20000]
Phase: Shifts the phase of the signal [0 1]
Offset: Offsets the signal amplitude [0 1]
Invert: Inverts the signal [0 1]
Custom Parameter
Here is a code example on the way to register a custom parameter callback function with Fabric,
public class CustomRTPParameter : MonoBehaviour, Fabric.ICustomRTPParameter
{
void Start ()
{
Fabric.FabricManager.Instance._customRTPParameter = this;
}
float Fabric.ICustomRTPParameter.UpdateProperty(Fabric.Component instance, Fabric.RTPProperty property, Fabric.RTPPropertyType type)
{
float value = 1.0f;
if ((Fabric.Component.RTPPropertyEnum)property._property == Fabric.Component.RTPPropertyEnum.Volume)
{
value = 0.707f;
}
else if ((Fabric.Component.RTPPropertyEnum)property._property == Fabric.Component.RTPPropertyEnum.Pan2D)
{
value = - 1.0f;
}
return value;
}
}