The example script, Reflective Detector (ReflectiveDetectorExample.cs), allows you to detect when an avatar collides with an object that contains the script. It sends data to the Reflective Tracker (ReflectiveTrackerExample.cs), which then tracks the number of hits.
You may add as many detectors as you want to objects in your scene. However, the script does not track collisions individually per detector. Instead, all detectors track hits on a scene-wide basis and tracks all collisions towards one tally.
Here is a step-by-step guide to using the script:
- Download the script files from the download link at the end of this article.
- Follow the instructions provided in Working with scripts to upload the scripts to your inventory.
- Simply drag the scripts to the scene and attach each script to an object. Remember, you may add as many detectors as you wish.
- There are no parameters for these scripts, so once you finish adding the scripts to your scene, save and build your scene.
- To test the script, visit the scene once it has been built.
|Note: These files are also available in the client folder: Program Files > Sansar > Client > Script API > Examples|
Creative Commons License
This content is licensed under the terms of the Creative Commons Attribution 4.0 International License. When using this content, you must:
- Acknowledge that the content is from the Sansar Knowledge Base.
- Include our copyright notice: "© 2017 Linden Research, Inc."
- Indicate that the content is licensed under the Creative Commons Attribution-Share Alike 4.0 International License.
Include the URL for, or link to, the license summary at https://creativecommons.org/licenses/by-sa/4.0/deed.hi (and, if possible, to the complete license terms at https://creativecommons.org/licenses/by-sa/4.0/legalcode.
"This work uses content from the Sansar Knowledge Base. © 2017 Linden Research, Inc. Licensed under the Creative Commons Attribution 4.0 International License (license summary available at https://creativecommons.org/licenses/by/4.0/ and complete license terms available at https://creativecommons.org/licenses/by/4.0/legalcode)."