Sansar Docs
Ask or search…

Follow The Path

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. 1.
    Download the script file from the download link at the end of this article.
  2. 2.
    Follow the instructions provided in Working with scripts to upload the script and add it to an object.
  3. 3.
    Open the object's Properties panel and go to the Script Settings section.
  4. 4.
    On the properties panel, set IsDynamic to On.
  5. 5.
    At the bottom of the object's properties panel is a Script Settings section. Upon looking at the Script Settings section for FollowThePath, 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.
  6. 6.
    Once you have finished setting the parameters for your object, your script is ready! Save and build your scene.
  7. 7.
    If you want to verify that the script is running correctly, visit the scene once it has been built.
Script parameters
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
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.
Have more questions? Join our Discord!​