Skip to main content

Lesson 3: Turn to Heading

The [Turn to heading] block can also be used to turn the VR Robot. This block turns the VR Robot to a given clockwise heading between 0 and 359.9 degrees. When a VR Robot collides with a castle, it may be knocked off course. The [Turn to heading] block ensures the VR Robot will turn to face the next castle no matter what previously happened.

VR Robot

This example will have the VR Robot move to knock over the center building, then turn and knock over the building in the bottom left corner on the Castle Crasher Playground.

middle bottom left
  • Remove the bottom two blocks from the project.
    remove bottom two blocks
  • Drag in the [Turn to heading] block and attach it beneath the [Drive for] block. Set the parameters of the [Turn to heading] block to 270 degrees.
    turn to heading
  • Drag in the [Drive for] block and attach it below the [Turn to heading] block. Set the parameters of the [Drive for] block to 700 millimeters (mm).
    heading 270 finished
  • Select the “Playground” button to launch the Castle Crasher Playground if it is not already open.
    Playground
  • Select the “Start” button to test the project.
    start
  • Watch the VR Robot move forward and collide with the center building before reversing back to the start. The VR Robot will then turn to a heading of 270 degrees and drive forward to collide with the building at the bottom left corner of the Castle Crasher Playground.
    Watch the VR Robot move forward and collide with the building

Mini Challenge

For this mini challenge, the VR Robot should collide with the middle building and the building on the top right of the Castle Crasher Playground. You will be given a project, but there is an error. Edit the project to solve the mini challenge!

mini challenge

Follow these steps to complete the mini challenge:

  • Watch the solution video to see how the VR Robot should move in order to complete the mini challenge
  • Create this project by adding or removing the necessary blocks to the Unit2Lesson3 project.
    create project
  • Start the project to see where the error is in the code.
  • Edit the code and try again. Continue this process until the mini challenge is complete.
  • Once the VR Robot successfully collides with the middle building and the building on the top right of the Castle Crasher Playground, save the project.
  • Save the project before moving on.

Congratulations! You solved the mini challenge!

Questions

Please select the link below to access the lesson quiz.

Open Lesson Quiz   >