Skip to main content

Lesson 3: Turning the VR Robot

Now that you have knocked over the first castle in the Castle Crasher Playground, you will need the VR Robot to turn to knock over another. This Lesson will walk you through the steps to turn the VR Robot and knock over two buildings on the Castle Crasher Playground.

Learning Outcomes

  • Identify how to use the [Turn for] block to turn the VR Robot right or left.
  • Identify how to use the [Turn to heading] block to turn the VR Robot to a given clockwise heading.

Rename the Project

  • If the previous lesson’s code is not already loaded, load the Unit2Lesson2 project.
  • Rename the project by selecting the project name box.
    rename the project
  • Enter the new project name Unit2Lesson3, and select “Rename.”
    enter new project

Turn Right or Left

The [Turn for] block rotates the VR Robot a given number of degrees. This example will have the VR Robot drive forward to knock over the center building, reverse back to the start, then turn and knock over the building in the bottom right corner on the Castle Crasher Playground.

castle crasher playground

For Your Information

To make a VR Robot turn at different speeds, the turn velocity can be increased or decreased using the [Set turn velocity] block.

turn velocity
  • Drag in the [Turn for] block and attach it beneath the [Drive for] block. Set the parameters of the [Turn for] block to turn right 90 degrees.
    1. Note: This project has the [Set drive velocity] and [Set turn velocity] blocks added and set to 100%. These are optional blocks.
      add right 90
  • Drag in the [Drive for] block and attach it below the [Turn for] block. Set the parameters of the [Drive for] block to 700 millimeters (mm).
    right finished
  • Select the “Playground” button to launch the Castle Crasher Playground if it is not already open.
    playground button
  • Select the “Start” button to test the project.
    start
  • Watch the VR Robot drive forward and collide with the center building before reversing back to the start. The VR Robot will then turn right 90 degrees and drive forward to collide with the building at the bottom right corner of the Castle Crasher Playground.
    turn right

Select the Next button to continue with the rest of this Lesson.