Component:AuthorityTimeBase: Difference between revisions

From Resonite Wiki
Added a link.
added a link to ProtoFlux:Source and an example image on how to use the component
 
Line 15: Line 15:
The output of the component is the current world time (as a [[Type:Double|Double]]) multiplied by the <code>BaseSpeed</code>, minus the <code>_actualOffset</code>.
The output of the component is the current world time (as a [[Type:Double|Double]]) multiplied by the <code>BaseSpeed</code>, minus the <code>_actualOffset</code>.


The output of the component is accessed by sourcing the component itself. To write to the current time of the component, you write to said source. When writing to the component source, <code>_actualOffset</code> is automatically updated to reflect the correct time. When writing to <code>BaseSpeed</code>, <code>_actualOffset</code> is automatically updated to keep the same time. Writing to <code>_actualOffset</code> does not affect any other fields.
The output of the component is accessed by [[ProtoFlux:Source|sourcing]] the component itself. To write to the current time of the component, you write to said source. When writing to the component source, <code>_actualOffset</code> is automatically updated to reflect the correct time. When writing to <code>BaseSpeed</code>, <code>_actualOffset</code> is automatically updated to keep the same time. Writing to <code>_actualOffset</code> does not affect any other fields.


== Examples ==
== Examples ==
[[File:AuthorityTimeBase_ProtoFlux.png|thumb|center|500px|An example that displays the currently computed time, allows it to be set back to 0 and that sets the speed to go forward (+1) or backward (-1) in time]]


== See Also ==
== See Also ==

Latest revision as of 19:06, 10 July 2024

Component image 
Authority Time Base component as seen in the Scene Inspector

The AuthorityTimeBase component allows for fine-grained control over the world time with a certain speed and with respect to a given offset.

Fields

Fields
Name Type Description
persistent Bool Determines whether or not this item will be saved to the server.
UpdateOrder Int Controls the order in which this component is updated.
Enabled Bool Controls whether or not this component is enabled.
BaseSpeed Float Speed of the time base.
_actualSpeed Float Actual speed of the time base. Should not be written to or driven.
_actualOffset Double Offset of the time base from the current world time. Can be written to or driven perfectly fine.

Usage

The output of the component is the current world time (as a Double) multiplied by the BaseSpeed, minus the _actualOffset.

The output of the component is accessed by sourcing the component itself. To write to the current time of the component, you write to said source. When writing to the component source, _actualOffset is automatically updated to reflect the correct time. When writing to BaseSpeed, _actualOffset is automatically updated to keep the same time. Writing to _actualOffset does not affect any other fields.

Examples

An example that displays the currently computed time, allows it to be set back to 0 and that sets the speed to go forward (+1) or backward (-1) in time

See Also