https://github.com/vrlabs/isrendering-detection
Be able to trigger things when players look at something
https://github.com/vrlabs/isrendering-detection
Last synced: about 1 year ago
JSON representation
Be able to trigger things when players look at something
- Host: GitHub
- URL: https://github.com/vrlabs/isrendering-detection
- Owner: VRLabs
- License: mit
- Created: 2023-02-27T23:53:26.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-04T20:39:48.000Z (over 1 year ago)
- Last Synced: 2024-12-04T21:34:20.894Z (over 1 year ago)
- Language: C#
- Size: 27.8 MB
- Stars: 11
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# IsRendering Detection
[](https://github.com/VRLabs/IsRendering-Detection/releases/latest)
[](https://github.com/VRLabs/IsRendering-Detection/blob/main/LICENSE)
[](https://img.shields.io/badge/Quest-Compatible-green?logo=Meta)
[](https://unity.com/releases/editor/whats-new/2022.3.22)
[](https://vrchat.com/home/download)
[](https://discord.vrlabs.dev/)
[](https://patreon.vrlabs.dev/)
Sets an "IsRendering" parameter to true when being looked at

### ⬇️ [Download Latest Version](https://github.com/VRLabs/IsRendering-Detection/releases/latest)
### 📦 [Add to VRChat Creator Companion](https://vrlabs.dev/packages?package=dev.vrlabs.isrendering-detection)
---
## 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
https://github.com/VRLabs/IsRendering-Detection/assets/76777936/b51ac145-17a8-47eb-acbf-883242073b6b
* Merge the Animator Controller ``IsRendering FX`` to your own FX Controller, using the [Avatars 3.0 Manager](https://github.com/VRLabs/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
```c++
Contact Receivers: 1
Contact Senders: 1
FX Animator Layers: 1
Skinned Renderers: 1
Sub Animators: 1
```
## Hierarchy layout
```html
IsRendering Detection
|-IsRendering Container
| |-Cube
|-NotRendering Container
| |-Sphere
|-Culling Animator
| |-Sender
| |-Receiver
| |-Renderer
```
## Contributors
* [hfcRed](https://github.com/hfcRed)
* [Dreadrith](https://github.com/Dreadrith)
## License
IsRendering Detection is available as-is under MIT. For more information see [LICENSE](https://github.com/VRLabs/IsRendering-Detection/blob/main/LICENSE).
[
](https://vrlabs.dev "VRLabs")
[
](https://discord.vrlabs.dev/ "VRLabs")
[
](https://patreon.vrlabs.dev/ "VRLabs")
[
](https://twitter.com/vrlabsdev "VRLabs")