Component:ColliderUserTracker: Difference between revisions

From Resonite Wiki
Automated: update Fields, Categories
fix up page, remove from component stubs
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<!--T:1-->
<!--T:1-->
{{stub}}
{{Infobox Component
{{Infobox Component
|Image=ColliderUserTrackerComponent.png
|Image=ColliderUserTrackerComponent.png
Line 6: Line 5:
}}
}}


The '''ColliderUserTracker''' keeps track of users who enter and leave a collider of type Trigger. The collider should be of type Trigger because that collider type will detect collisions with users (as long as they are not in noclip locomotion mode).
The '''ColliderUserTracker''' keeps track of users who enter and leave a collider. It must be used on a Slot that also has an attached Collider whose type is set to "Trigger", unless <code>TriggersOnly</code> is set to false.
 
As this component works using colliders, it cannot detect users in No-Clip.


<!--T:2-->
<!--T:2-->
== Fields ==
== Fields ==
{{Table ComponentFields
{{Table ComponentFields
|TriggersOnly|Bool|
|TriggersOnly|Bool| Whether to only allow use of Triggers or not.
|IsLocalUserInside|{{RootFieldType|RawOutput`1|[[Type:Bool|Bool]]}}|TypeAdv1=true| Becomes set for the local user if the local user is within the collider of the object that this component is attached to.
|IsLocalUserInside|{{RootFieldType|RawOutput`1|[[Type:Bool|Bool]]}}|TypeAdv1=true| Becomes set for the local user if the local user is within the collider of the object that this component is attached to.
|IsAnyUserInside|{{RootFieldType|RawOutput`1|[[Type:Bool|Bool]]}}|TypeAdv2=true| Becomes set for all users if any user is within the collider of the object that this component is attached to.
|IsAnyUserInside|{{RootFieldType|RawOutput`1|[[Type:Bool|Bool]]}}|TypeAdv2=true| Becomes set for all users if any user is within the collider of the object that this component is attached to.
Line 20: Line 21:
<!--T:3-->
<!--T:3-->
== Usage ==
== Usage ==
{{stub}}
Attach this component to a slot, and add a [[Colliders|Collider]] to the slot. The component will then start functioning as long as the Collider is a trigger or as long as <code>TriggersOnly</code> is set to false.


<!--T:4-->
<!--T:4-->
== Examples ==
== Examples ==
{{stub}}
This component can be very useful in defining zones in a world for various features, the most common of which is using the <code>IsLocalUserInside</code> to drive the Enabled state on various slots to work as a culling system.


[[Category:ComponentStubs]]
[[Category:Components:Physics:Utility{{#translation:}}|Collider User Tracker]]
[[Category:Components:Physics:Utility{{#translation:}}|Collider User Tracker]]
[[Category:Components{{#translation:}}|Collider User Tracker]]
[[Category:Components{{#translation:}}|Collider User Tracker]]

Latest revision as of 17:16, 16 October 2024

Component image 
Collider User Tracker component as seen in the Scene Inspector


The ColliderUserTracker keeps track of users who enter and leave a collider. It must be used on a Slot that also has an attached Collider whose type is set to "Trigger", unless TriggersOnly is set to false.

As this component works using colliders, it cannot detect users in No-Clip.

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.
TriggersOnly Bool Whether to only allow use of Triggers or not.
IsLocalUserInside raw output of Bool Becomes set for the local user if the local user is within the collider of the object that this component is attached to.
IsAnyUserInside raw output of Bool Becomes set for all users if any user is within the collider of the object that this component is attached to.
NumberOfUsersInside raw output of Int Tracks the number of users inside the collider of the object that this component is attached to.
_usersInside direct SyncBag`1<UserRef> Data on the users that are inside the collider of the object that this component is attached to.

Usage

Attach this component to a slot, and add a Collider to the slot. The component will then start functioning as long as the Collider is a trigger or as long as TriggersOnly is set to false.

Examples

This component can be very useful in defining zones in a world for various features, the most common of which is using the IsLocalUserInside to drive the Enabled state on various slots to work as a culling system.