An action controller is a bit like a Handler it allows you to connect existing Controller to an existing resource. Once connected to Controller will propagate its variables to the resources to insure proper machine state execution. Based on the behaviours defined by the ActionClip the Controller will be evaluated independently based on the values of the variables value of the resource it is connect with. In other words the action controller act like a bridge between the resource and the Controller keeping an independent machine state via the ActiveClip structure.
See Also
Static Variables
Variables
Functions
Name | Description |
SetController | Connect or disconnect a Controller asset. |
Declaration bool SetController( Controller *controller ) Parameters
Return Value
true if the Controller on success; false if the Controller is connected to an Armature and the current resource is not a SkeletalMesh or if the two skeletons (the one connected to the object and the armature) are not the same.
- Note
- Passing a
nil value to the controller parameter will disconnect the Controller (if any).
|
SetState | Force the ActionController to a specific state. |
Declaration int SetState( const char *actionlayer_name, const char *actionclip_name, float playback_time, float transition_time ) Parameters
actionlayer_name : The name of the ActionLayer you are targetting.
actionclip_name : The ActionClip name contained in the ActionLayer.
playback_time : Specify the playback time that should be assigned to the ActionController.
transition_time : Control the duration that the current machine state of the ActionController will take to switch to the state specified using this function.
Return Value
On success the function will return 0 else:
-1 : The action controller does not have a connected controller asset.
-2 : The function receive a nil action layer name.
-3 : The function receive a nil action clip name.
-4 : The action layer specified by the actionlayer_name parameter cannot be found.
-5 : The action clip specified by the actionclip_name parameter cannot be found.
|
Restart | Force the ActionController to restart to its original machine state. |
Declaration Return Value
false if there is no Controller connected; else true as the original state can be evaluated.
|
GetVariable | Retrieve the local resource (object or scene) Variable defined inside the Controller. |
Declaration Variable *GetVariable( unsigned int uid ) Parameters
Return Value
The local resource Variable reference pointer else nil .
|
GetActiveClip | Retrieve the active machine state structure for a specific ActionLayer. |
Declaration ActiveClip *GetActiveClip( unsigned char actionlayer_index ) Parameters
Return Value
The current machine state structure for the ActionLayer index; else nil if the actionlayer_index is out of bounds.
|
Update | Manually update the ActionController. |
Declaration void Update( bool force ) Parameters
force : Pass true to force the ActionController update; else it will only be updated based on valid time intervals (see fps ).
|
Events
Callbacks | Description |
OnEnter | Occur each time the ActionController is entering a new state. |
Declaration Example
Lua function OnEnter()
-- Print the name of the active machine state (the actionclip name).
print( "Entering:" .. this.name )
end
|
OnLeave | This event is triggered each time the ActionController leave its current state. |
Declaration Example
Lua function OnLeave()
-- Print the name of the active machine state.
print( "Leaving:" .. this.name )
end
|
OnState | This callback is triggered every time the active machine state is updated. |
Declaration Example
Lua function OnState()
-- Print the name of the active actionclip.
print( "Updating:" .. this.name )
end
|
OnUpdate | Called everytime the ActionController is updated. |
Declaration Example
Lua function OnUpdate()
-- Print the active actioncontroller name.
print( "Updating:" .. this.name )
end
|
ActiveClip
Represent the active machine state maintained internally for an ActionController for each of its ActionLayer.
Static Variables
Name | Description |
previous | The previous ActionClip current state was derived or interpolated from (else nil ). |
Declaration
|
previous_time | The playback time maintained by the previous ActionClip state. |
Declaration
|
actionclip | The active Controller machine state for the action ActionController. |
Declaration
|
playback_time | The current playback time of the active machine state ActionClip. |
Declaration
|
transition | The active transition the machine state is currently processing (if any, else nil ). |
Declaration
|
transition_duration | The active Transition duration (if any, else 0 ). |
Declaration float transition_duration
|
transition_source | The ActionClip the action machine state Transition was triggered from. |
Declaration ActionClip *transition_source
|
blend | Represents the interpolation ratio between the current and previous ActionClip based on the active Transition duration. |
Declaration - Note
- The
blend value is calculated as follow: blend =blend_time /transition_duration .
|
blend_time | The active interpolation time that is progressively incremented in order to reach the transition_duration . |
Declaration
|