Click the Add Scene button and choose a 3D scene.
Adding Meshes
Click the Add Mesh button in the Meshes window, and click the chessboard mesh to add.Click the View Selection All button (second icon down on the left of the viewport) to view the chessboard.
Click the Add Mesh button again, and this time add the chesspiece_rook_white mesh.
Now move the object around with the gizmo until it's on the square closest to the camera.
Adding Cameras
We're now going to make two different cameras in this scene.We've already got one by default, so lets add another in the Objects window.
Find the Objects window (top left) and click the dropdown menu of the Add Object button. Chose Camera and a new camera 'camera_2' will appear in the list.
From the Objects window again, now select the chesspiece and press the View Selection All button.
The chesspiece should now fill the viewport. Copy this view to camera_2 using "Copy Viewport To Selected Camera" under "Camera Settings (fifth icon down on the left of the viewport).
It's a good idea to save you document at this point by selecting "File" then "Save As".
Document Level
We now have a 3D scene with 2 camera views - but how are these used?Let's go back to the top level (Document level) to see what has happened.
To get back there, click the tab with the document name in the top left of DX Studio (currently should be Untitled*).
You can now see the Layers and Layer Properties windows. In the Layer Properties window, change the Initial Camera dropdown to be camera_2.
This is setting up which camera in which scene the layer 'layer_1' will display.
You can add as many layers as you like to a scene - so let's add a 2D overlay now!
Press the Add Scene button (bottom right) again and this time add a 2D scene.
Adding 2D Content
Great! Now let's add some 2D graphics into this scene.Find the Bitmaps window (bottom left) and press the Add Bitmap button.
Choose bitmapbutton_red and it will appear in the scene.
Move the bitmap into the bottom left corner.
Press the Add Bitmap button again and this time add bitmapbutton_green to the scene.
Move this bitmap into the other corner (bottom right).
Adding Script
If you hit F12 now, you'll see the two 2D buttons are overlaid on the camera_2 view! But the buttons don't yet do anything, so press ESCAPE to return to the editor.To make things work we need script, so with the green button selected right click the button and choose Edit Script.
In the script editor (CodePad) double click the 'onClick' event (top right), then enter the following line between the curly braces { } in the code window:-
layers.layer_1.camera="camera_2";
Go back to the viewport, select the red button, right click and choose Edit Script again.Another empty script will appear, so double click 'onClick' again, but this time enter this script:-
layers.layer_1.camera="camera_1";
Close the CodePad editor and choose to save changes to your scripts.These scripts will change the camera in layer_1 depending on whether you press the red or green button.
0 comments:
Post a Comment