Component:UserDistanceValueDriver
More actions

The UserDistanceValueDriver switches or flip flops or flips between two different values like a conditional or ternary operator when a user is close to or far away from the slot this component is on. The switch is local.
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. Some components stop their functionality when this field is disabled, but some don't. |
Node
|
UserRoot.UserNode | The user node to check distance from. |
Distance
|
Float | The distance to use when checking near vs far. |
TargetField
|
field drive of T | The field to drive with either NearValue or flip to FarValue depending on distance.
|
NearValue
|
T | The value to use to drive TargetField with when the local user Node under Distance away from this component's slot in global space.
|
FarValue
|
T | The value to use to drive TargetField with when the local user Node over Distance away from this component's slot in global space.
|
Usage
Attach to a slot that a distance to the local user for a particular slot in global space needs to be checked for. Then provide values for all the component's fields in order for it to work.
Examples

Can be used to activate a nameplate visual when the user is close, so the activation based on distance stays local.
It is also a quick and easy way to make a culling system for world items, deactivating flux or heavy rendering when a user is a distance away.
The example on the left uses UserDistanceValueDrive combined with BooleanValueDriver to control the shadows of a Light to increase performance of a world.