Skip main navigation

Rotation Exercise

Simple object rotation exercise

Now that we know how to describe the rotation of objects in virtual worlds, let’s put it into practice.

Rotation Exercise

The objective of this exercise is to explore static rotation. You will notice that rotation in virtual worlds is not intuitively obvious. We start with a model airplane positioned on the X-axis. We will also provide a set of desired rotational orientations. Your task is to update/change the rotation coordinates of the dolly to achieve the desired orientation for each task.

We have provided the baseline source code (see the “See Also” section at the bottom of the page). To work on the exercise, copy the file contents to Glitch or CodePen as per your preference. If you simply run the provided file in a browser, you will see output similar to one in Figure 1.

Initial position of airplane model Figure 1: Initial position of airplane model and the axes for reference

To update the rotation of the airplane, update the rotation attribute for the ‘dolly’ entity:

 <a-entity id="dolly" rotation="0 0 0">

The rotation attribute can be read as: “<rotation for x-axis in degrees>, <rotation for y-axis in degrees>, <rotation for z-axis in degrees>”

Each task shows you what the orientation of the airplane should look like. Modify the rotation attribute (using Glitch/CodePen/Notepad) such that the resulting output matches the required orientation.

Hint: The answers for all the tasks involve one of these three values for each of the axes: [-90, 0, 90]

Task 1: Re-orient the airplane to match the arrangement in Figure 2.

Task 1 orientation Figure 2: Task 1 Orientation

Task 2: Re-orient the airplane to match the arrangement in Figure 3.

Task 2 orientation Figure 3: Task 2 Orientation

Task 3: Re-orient the airplane to match the arrangement in Figure 4.

Task 3 orientation Figure 4: Task 3 Orientation

This article is from the free online

Construct a Virtual Reality Experience

Created by
FutureLearn - Learning For Life

Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education