/IsRendering-Detection

Be able to trigger things when players look at something

Primary LanguageC#MIT LicenseMIT

IsRendering Detection

Generic badge Generic badge Generic badge Generic badge Generic badge

Generic badge Generic badge

Sets an "IsRendering" parameter to true when being looked at

IsRendering


How it works

  • The prefab contains a sub-animator, a sender, a receiver, and a renderer.
  • The sub-animator constantly animates the sender on, setting IsRendering to true.
  • When the renderer is not in view, the sub-animator stops running and will no longer animate the sender on.
  • The main-animator can then animate the sender off, setting IsRendering to false.

Install guide

Isrendering-Detection-8.mp4
  • Merge the Animator Controller IsRendering FX to your own FX Controller, using the Avatars 3.0 Manager tool.
  • Drag & Drop the IsRendering Detection prefab into the base of your Hierarchy.
  • Right click and unpack the prefab, then drag & drop it onto your avatar.
  • Expand the prefab hierarchy and find Culling Animator -> Renderer.
  • Modify the bounds of the renderer to fit the view target such as your avatar.

Note

When building for Quest, you will have to remove unsupported components and shaders

How to use

  • Add the RenderingDetection/IsRendering bool parameter to any of your Playable Layers. The value will be True when Renderer is in view, and false when outside of view.
    • You can use this bool to build your own systems in your FX Controller.
  • In the prefab's hierarchy, the IsRendering Container is enabled when in view. IsNotRendering Container is enabled when not in view.
    • You can put your own objects into the containers to show or hide them accordingly
    • The containers include a cube and sphere for previewing and confirming that the system works; feel free to delete them.

Performance stats

Contact Receivers:  1
Contact Senders:    1
FX Animator Layers: 1
Skinned Renderers:  1
Sub Animators:      1

Hierarchy layout

IsRendering Detection
|-IsRendering Container
|  |-Cube
|-NotRendering Container
|  |-Sphere
|-Culling Animator
|  |-Sender
|  |-Receiver
|  |-Renderer

Contributors

License

IsRendering Detection is available as-is under MIT. For more information see LICENSE.