imported>Mysticporo Created page with "<languages></languages> <translate> <!--T:1--> {{stub}} {{Infobox Component |Image=DynamicReferenceVariableDriver`1Component.png |Name=Dynamic Reference Variable Driver`1 }}..." |
m fix arrow |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
<translate> | <translate> | ||
<!--T:1--> | <!--T:1--> | ||
Dynamic Reference Variable Driver is a component that can drive a [[Type:SyncRef`1|SyncRef`1 (Reference Holder)]] to the value assigned to a dynamic variable with the name <code>VariableName</code>. if the specified variable cannot be found, the value will revert to <code>DefaultTarget</code> how this works is explained on [[Dynamic Variables]] page. | |||
{{Infobox Component | {{Infobox Component | ||
|Image=DynamicReferenceVariableDriver`1Component.png | |Image=DynamicReferenceVariableDriver`1Component.png | ||
Line 11: | Line 11: | ||
== Fields == | == Fields == | ||
{{Table ComponentFields | {{Table ComponentFields | ||
|VariableName|String| | |VariableName|String| {{Template:Variable Name Component}} | ||
|Target|SyncRef`1|TypeString1=SyncRef<IWorldElement>| | |Target|SyncRef`1|TypeString1=SyncRef<IWorldElement>| | ||
|DefaultTarget|IWorldElement| | |DefaultTarget|IWorldElement| {{Template:DefaultTarget Field}} | ||
}} | }} | ||
Line 21: | Line 21: | ||
<!--T:4--> | <!--T:4--> | ||
== Examples == | == Examples == | ||
This component can be used as a way of abusing how dynamic variables are read by making this component with a [[Type:Slot|slot type]]. Since this component reads from the slot it is on, this component can drive the parent field of another slot. Using this in tandem allows for interesting behavior. | |||
For example: | |||
Start with an avatar that has a slot on it's head, with a [[Component:DynamicReferenceVariable|DynamicReferenceVariable<Slot>]] pointing to it with the <code>VariableName</code> field having "User/Hat" in it. then have an item like a hat stand with the stand slot having a DynamicReferenceVariableDriver<[[Type:Slot|Slot]]> with a <code>VariableName</code> with "User/Hat" on it. the <code>DefaultTarget</code> would be the slot the component is on, which is the hat stand. The hat stand would a hat parented to it. the hat would have it's parent field driven by the component on the hat stand. Since the hat stand would be sitting in a world, the hat will stay on the stand, since it can't find the variable, "User/Hat". the second a user picks the stand up with a slot variable that is named "User/Hat", the hat will move from the stand to the slot specified by the variable on that user. Keep in mind, that the hat in this scenario has nothing to do with how the variable is read, but rather the stand does. When the stand unparents from the user, the slot sampling the variable space which is the stand can no longer find the variable. What then happens is the field the DynamicReferenceVariableDriver<[[Type:Slot|Slot]]> is driving will revert to <code>DefaultTarget</code> which is the stand slot, making it move back to the stand. | |||
This also allows for the slot that moves (also known as the hat) to sample values too, allowing for even more complex reading and interaction (EX: the hat moves to the user's head and changes color to the user's color) | |||
<!--T:5--> | <!--T:5--> | ||
== Related Components == | == Related Components == | ||
</translate> | </translate> | ||
[[Category:Generics{{#translation:}}]] | [[Category:Generics{{#translation:}}]] | ||
[[Category:Components{{#translation:}}|Dynamic Reference Variable Driver`1]] | [[Category:Components{{#translation:}}|Dynamic Reference Variable Driver`1]] | ||
[[Category:Components:Data:Dynamic{{#translation:}}|Dynamic Reference Variable Driver`1]] | [[Category:Components:Data:Dynamic{{#translation:}}|Dynamic Reference Variable Driver`1]] |
Latest revision as of 16:37, 19 March 2024
Dynamic Reference Variable Driver is a component that can drive a SyncRef`1 (Reference Holder) to the value assigned to a dynamic variable with the name VariableName
. if the specified variable cannot be found, the value will revert to DefaultTarget
how this works is explained on Dynamic Variables page.
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. |
VariableName
|
String | The Variable name that will be used to link this component's refrenced value to the Dynamic Variables System. |
Target
|
SyncRef<IWorldElement> | |
DefaultTarget
|
IWorldElement | The value/reference to revert to when this component cannot find the specified VariableName dynamic variable.
|
Usage
Examples
This component can be used as a way of abusing how dynamic variables are read by making this component with a slot type. Since this component reads from the slot it is on, this component can drive the parent field of another slot. Using this in tandem allows for interesting behavior.
For example:
Start with an avatar that has a slot on it's head, with a DynamicReferenceVariable<Slot> pointing to it with the VariableName
field having "User/Hat" in it. then have an item like a hat stand with the stand slot having a DynamicReferenceVariableDriver<Slot> with a VariableName
with "User/Hat" on it. the DefaultTarget
would be the slot the component is on, which is the hat stand. The hat stand would a hat parented to it. the hat would have it's parent field driven by the component on the hat stand. Since the hat stand would be sitting in a world, the hat will stay on the stand, since it can't find the variable, "User/Hat". the second a user picks the stand up with a slot variable that is named "User/Hat", the hat will move from the stand to the slot specified by the variable on that user. Keep in mind, that the hat in this scenario has nothing to do with how the variable is read, but rather the stand does. When the stand unparents from the user, the slot sampling the variable space which is the stand can no longer find the variable. What then happens is the field the DynamicReferenceVariableDriver<Slot> is driving will revert to DefaultTarget
which is the stand slot, making it move back to the stand.
This also allows for the slot that moves (also known as the hat) to sample values too, allowing for even more complex reading and interaction (EX: the hat moves to the user's head and changes color to the user's color)