In Sansar, scripts allow you to add dynamic and interactive behaviors to objects. Here are a few example scripts that you can experiment with in Sansar.
|Example Script||Script Details|
|Visitor Tracker (VisitorTrackerExample.cs)||This script tracks the number of visitors that visited your experience over the course of a session.|
|Follow The Path (FollowThePath.cs)||This script moves a dynamic object along a route of points, in a loop.|
|Random Movement (RandomMovement.cs)||This script randomly moves a dynamic object around its starting position.|
|Teleport Hotkeys (TeleportHotkeys.cs)||This script allows you to set hotkeys that will teleport users to another experience when pressed.|
|Stats Example (StatsExample.cs)||This script provides useful statistics about the current experience.|
|Sound Randomizer (SoundRandomizer.cs)||This script plays randomly from a list of sounds at randomized intervals.|
|Cannonball (CannonGameExample.cs)||This script throws a cannonball from the avatar.|
|Reflective Detector (ReflectiveDetectorExample.cs) & Reflective Tracker (ReflectiveTrackerExample.cs)||
These two scripts detects and tracks how many times the users hit the detectors in objects in a scene.
|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)."