Is there a way to code a path tracing the steps of a viewer?


#1

I am wondering if there is a way to trace a path on the ground that will show a viewers footsteps around a maze? As the viewer walks, a path would be created to show them where they have been.

Thanks for any advice!


#2

Hi Kevin,

to create a path you can make copies of an item that act as a path-point. Here’s how to do it.

  1. Choose an item you want to use as a path-point. In this case, I chose a “blue dot” image from our web search.
    CreateDot

  2. Then we create the following Blockly code:
    image

Code explanation

We create a function called “createFootStep” (or similar). In the function, a newPathDot is created by copying the path-item in the scene. Then the position of this newPathDot is set to the X and Y location of the Camera. The height of the path is 0 so that it is on the ground (in case the viewer walks up a slope, you could subtract a value from the camera’s Z position instead).

Then we use the repeat block to call this function every 2 seconds.

Make sure that you use a pause block in the repeat - loop, otherwise you’re creating too my items in the scene.

  1. Watch the code in action. Every two seconds, a blue dot is dropped on the floor where the viewer stands.
    PathDots

Hope this helps you getting started! You can replace the dot with any other item.