Navigation |
Exercise 1Exercise 1: Rotating a Cube
Subjects covered:
You will need: Assets:File cube.nmo in VirtoolsResources\3DEntities\Primitives folder.
BB:BB Rotate in 3D Transformation\Basic folder.
Setting-up:
Note: If you aren't able to access the C drive on your computer, paste the address location into the 'File name' prompt after you click 'Open Data Resource'.
Importing assets:
TIP: Always rename an object in the Level Manager to avoid future confusion. The F2 key is a shortcut to renaming an object. Adding Virtools objects:1. To add a light go to the menu on the left side of the 3D Layout and go to the Create Light icon that appears to be little lightbulb. Note that if you find you don’t know what a particular icon does, holding the mouse over the icon for a few seconds will produce the name of the icon in a little yellow box. Virtools may ask if you want to activate the light, which you should say Yes to. 2. Regardless, make sure you click on the “Active” checkbox in the middle of the Point Light Setup screen so that a light bulb appears in the middle of the screen, more of less on top of your box. 3. To move the light off the box so you illuminate a side of the box, edit the X and Y coordinates, and if you’re feeling adventerous, the Z co-ordinate. Just type in the new number (such as 1.00) for a co-ordinate, and the light bulb should move. When you turn the “Active” checkbox off and on the light’s illumination on the box should turn off and on. 4. To add a camera go to the icon immediately to the left of the ‘Create Light icon on the right hand side of the 3D Layout screen. You’ll then see a range of choices for positions and orientation appear in the bottom where the Level Manager usually is, under the tab Target Camera Setup. Feel free to change the co-ordinates, and you’ll see the X created by the perspective of the camera, and moving the co-ordinates should be reflected in the 3D Layout screen. Creating behaviours:Create a script for the 3D Object (cube) that will allow it to rotate in a loop. Go to the Building Blocks tab on the upper right hand portion of the screen. Then open the 3D Transformations/Basic menu, and select the Rotate Behavior. In the Level Manager, and then under Global/3DObjects/MyCube, you can see if your cube has any scripts attached to it. To attach a script, right click on the Cube either in the 3D Layout or the Level Manager, and select the Create Script Option. Then click on that MyCube Script and the script editor should show up under the Schematic menu. Then, drag and drop the Rotate from the Building Blocks menu to the Schematic, where now a Rotate building block should appear. In the Schematic, you want to grab the tab sticking out of the My Cube and connect it to the new Rotate Building Block. Since you may want to see your cube rotate more than once, now take that line and stretch it till it reconnects to the line in front of the Rotate cube, forming a loop in the line. If connected successfully, the line will blink a greenish color and should not disappear when you do other actions. Now double-click on the Rotate building block and you should get a menu that allows you to edit the axis of rotation and the angle of rotation. Change the angle of rotation to a more interesting angle such as 30. Then you can press the Play button on the absolute bottom right hand corner of the screen to see your cube rotate! Saving as a web format (secured format):Save the composition as Cube.vmo in a vmo format by going to File ? Export to Virtools Player. Remeber where you’ve saved it! Running a web version using Virtools Web Player:Now using Windows File Manager, find the Cube.vmo file that you saved your spinning cube in, and drag & drop the Cube.vmo file into the Internet Explorer window. If you don’t see a spinning cube appear make sure you have ActiveX controls on - see if a message appears on your screen telling you that content is being blocked, then click on the button that allows ActiveX and other forms of content to be played. Also, you may have to hit the “Refresh” button on your browser. |