VisibleNetworkRigidbody
A class in Root.Township, the global namespace.
Client: turns off a group of NetworkRigidbody components (inactive and kinematic) while a bounding sphere is out of the local player's camera view, and back on when it comes into view. Does nothing on a headless server.
- Listed in Global namespace: T to X
- Inherits or implements
ComponentGroup<NetworkRigidbody>,IUpdateOnMove
Constructors
| Member | What it is |
|---|---|
VisibleNetworkRigidbody() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
4 private and internal fields
Methods
7 private and internal methods
| Member | What it is |
|---|---|
private void Initialize(PlayerController current) | Builds a culling group on the player's camera and starts with all the rigidbodies off and kinematic. |
private void IUpdateOnMove.Moved() | Rebuilds the culling group when the object moves. The sphere keeps the position set in Start. |
private void OnDestroy() | Disposes the culling group and unhooks PlayerController.LocalPlayerSet. |
private void OnDrawGizmosSelected() | Draws the visibility sphere in the editor. |
private void Reset() | Disposes the current culling group. |
private void Start() | Client: makes the bounding sphere and initialises now or when the local player is set. |
private void UpdateVisibility(CullingGroupEvent sphere) | Culling callback: turns the rigidbodies on and refreshes them when visible, off and kinematic when hidden. |