Reflective Detector

Example Script: Reflective Detector and Tracker

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:

  1. Download the script files from the download link at the end of this article.

  2. Follow the instructions provided in Working with scripts to upload the scripts to your inventory.

  3. Simply drag the scripts to the scene and attach each script to an object. Remember, you may add as many detectors as you wish.

  4. There are no parameters for these scripts, so once you finish adding the scripts to your scene, save and build your scene.

  5. 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

Have more questions? Join our Discord!

Last updated