Navigating in 3D

Creating a Scene

First, press the Add Scene button and choose a new 3D scene.
Then press the Add Mesh button in the bottom left of the 3D Scene Editor (Meshes window), and choose the house object.


Navigation

Now we're going to work through how to navigate and control this simple scene in the editor.
The first control is the Select tool (press ESCAPE in the viewport to go back to this at any time).
You can left click on and off the house to select/deselect it, or drag a box in the viewport to select all that fall within it.
Right clicking in the viewport brings up a menu for the selected object.
If you're doing anything in a complicated scene and don't want to lose the selection, press the Lock Selection button (it's the padlock icon on the same strip as the Select tool) or just press the Ctrl L key to toggle it on and off (when the viewport has focus).
Leave selection unlocked for the moment.
You can now try moving, rotating and scaling the house Using the Gizmo.

Mouse and arrow keys

Holding down the right mouse button as you drag the mouse pans and tilts the camera. The mouse wheel zooms tighter and wider in steps. The up down arrow keys allow you to dolly closer and further from the house (back and forth). The right and left arrow keys allow you to track the camera side to side. With one hand driving the keys and one steering the mouse you can “fly” through the scene.
Click on the scene off the house to de-select the house.

Holding down the space bar and the left mouse button allows you to crane the camera position higher and lower.

Setting up the Camera

Before previewing your scene in the player it is a good idea to adjust the camera to your desired view. You can do this by selecting the camera in the objects list and moving it into position with the gizmo. You can also simply navigate in the viewport to your desired position for the camera and then use the Copy Viewport To Selected Camera option under the camera icon in the vertical toolbar (it's the fifth icon down).

Moving In the Player

Run the scene by pressing the F12 key. The default light for the scene has ended up inside the house so the scene is dark except for the lit interior of the house.
Tilt the camera so the open front door is centre of the screen. Press the “up” arrow key to move the position of the camera to the doorway. Level up with the right mouse key to look at the opposite interior wall. A slight move forward puts you in the centre of the house where you can look around at the interior.
Click the standard window “x” at the top right of the player window to close the scene and automatically take you back to the 3D work space (or just press ESCAPE).
To the far left of the DX Studio user interface is the object menu. Select the light. Use the gizmo to put the light just outside the house.

At the bottom of the vertical Tool bar there is an icon that looks like a pair of curved arrows. This is the “Orbit Selection (O)” button. Click on it or press the “O” key. Press the left mouse button and drag left/right, up and down. If the light is still selected the camera should snap to centre on it.
Select the house and take a look around the outside of the house.
Put the light back inside the house roughly where it was.
The up and down arrow keys move you closer or further from the house.
Browse to the meshes folder in the Library, select the “ground_plane” mesh and add it to your scene.

At the top of the vertical tool bar there are two computer screen icons. Click on the top icon (View Overview) or press (Cntr + Shift + O). This takes you to a view of everything that is now in the scene.
It would take you a long time to “fly” back down to the house from here using the arrow keys. Select the house in the object menu to the left.
Click the View “Selection” button. This is the second icon, a screen with an object on it, or go to the main “View” menu and select it there. This gives you a view where the house fits nicely in the work space window.

Render Wireframe View

In the Add New Mesh panel select “Online Library”. This takes you to a web page with a number of thumbnails of objects. Click on the “Military Jeep”. On the page that comes up click on the thumbnail again and it will load directly into your scene. But it is located at the origin of the scene, which is inside the house.
Two thirds of the way down the vertical tool bar on the left of the 3D Work space are two icons with primitive shapes in them. Click on the top one to give a wireframe view. You should now see the jeep more clearly inside the plan of the house.

Click on the wireframe view icon again to go back to the normal view.
Select the car jeep the object list. Right click in the 3D work space and select Edit Pos/Rot/Scale. Enter -3 in the “x” field and -12 in the “z” field.
You may need to multiply or divide these by ten depending on what your world units are set to.
Click the degrees button. In the “y” field enter -90 and click OK. Click the “x” at the top right of the properties window to close it.

Scripted Keyframing

In this section you will add a short section of script or code to set keyframes and animate the car in the player.
With the jeep still selected right click and select Edit Script.
Click the “full screen” box at the top right to give yourself room to work. From the list at the top right select “onClick”. The following text should appear in the main script editing window.

function onClick()
{
}
Copy and paste the following text to In between the curly brackets.

 var  seq_01 = object.createSequence("Jeep", 4); // create a new sequence called "Jeep" that's 4 seconds long.
 seq_01.createPositionKeyframe(0, new Vector  (-3,0,-10), "stepped"); 
 seq_01.createPositionKeyframe(3, new Vector  (6,0,-10), "stepped"); 
 object.sequence="Jeep"; // activate the sequence.
 print ("Clicked"); 
Again, you may need to multiply or divide the Vector values by ten depending on what your world units are set to. You should end up with the following

function onClick()
{
 var  seq_01 = object.createSequence("Jeep", 4); // create a new sequence called "Jeep" that's 4 seconds long.
 seq_01.createPositionKeyframe(0, new Vector  (-3,0,-10), "stepped"); 
 seq_01.createPositionKeyframe(3, new Vector  (6,0,-10), "stepped"); 
 object.sequence="Jeep"; // activate the sequence.
 print ("Clicked"); 
 
}
Run the scene by pressing the F12 key. Click on the jeep. The jeep should move a short distance in front of the house and the word "Clicked" should print out at the top of the screen.
It’s always a good idea to have at least one print command. If you get the text but no movement at least you know the function has responded to the click.
You can add a sky dome and move the light outside the house to change the time of day.

That concludes this tutorial.

0 comments:

Post a Comment