Example Script: Follow the Path

The example script, Follow the Path (FollowThePath.cs), which moves a dynamic object along a route of waypoints in a loop. Grab it at the download link at the end of the page.

Here is a step-by-step guide to using the script:

  1. In the My Experience app, choose the scene you want to edit and click the Edit Scene edit_icon_sm.png button.
  2. If you already have the file in your inventory, jump to step 3 to start using the script. Otherwise, download the FollowThePath.cs example script at the end of the page and upload the file into your inventory. See Uploading and Applying Scripts for more information.
  3. Now that you have the script in your inventory, choose an object in the scene that you want to apply the script to.
  4. Select the FollowThePath.cs file from your Inventory and drag the script onto the object in the scene. 
  5. Now that the script has been applied on the object, open the properties panel for the object. On the properties panel, set IsDynamic to On.
  6. At the bottom of the object's properties panel is a Script Settings section. Upon looking at the Script Settings section for FollowThePath.cs, you will see a list of parameters which you can set for the object. Setting values on these parameters can help you set the movement of your object. 

    Here is a short guide for each parameter you can set: 


    Speed allows you to set the speed of an object. It is best to set the Speed value between 5 to 25.

    Position 1

    Position points help define the route of your object along an intended path.

    The object's starting position is always at the point at which the object was placed. In total, you may add up to 7 position points for each object by filling the <x,y,z> points with values. However, you may also choose to have fewer position points.

    By default, <0,0,0> is set as the <x,y,z> position point for all position points. When <0,0,0> is set, no position point is assigned to that slot.

    Position 2
    Position 3
    Position 4
    Position 5
    Position 6
    Position 7
    Loop If Loop is set to ON, the objects will move and follow the route of points repeatedly. If Loop is set to OFF, the object will warp to the start point after it reaches the end of the defined position points. 
    On Collide TP Dest On Collide TP Dest allows you to set a teleport function. If set, an avatar will be teleported to the defined position point when the object comes into contact with it. 
  7. Once you have finished setting the parameters for your object, your script is ready! Save and build your scene.
  8. If you want to verify that the script is running correctly, visit the scene once it has been built.  

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.

For example:

"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)."


Download Link: 

Was this article helpful?
9 out of 9 found this helpful
Have more questions? Submit a request


Article is closed for comments.