Learning Blender and BGE by making an analog clock – tutorial
Making the analog clock in blender for beginers
Since I’ve been training interns here at work, I noticed that, for some reason, logic bricks seem quite dificult at first and a lot of interns ask me about a good tutorial. Then I point the students to a tutorial/video tutorial but the result is mostly the same, confusion about how to get things working with the logic bricks.
So I decided to write starting by the basis, just the way I learnt. And being said that, I do not consider myself as a “Logic Brick guru” but I find this kind of programing very interesting and fast, despite its own limitations. And also, this tutorial is going to be just like in the old times, you know.. now is very common to see every tutorial as a “video tutorial” in youtube, and this is great, but I firmly that many other topics are more easy to understand just by reading and looking at pictures.
So, asuming you don’t know much about blender and want to learn the basis of its Logic Bricks, continue reading!
Where to begin?
If you already know how to use certain things in blender like: move, rotate, scale, add objects and move between different views (front, top, back, bottom, etc) then skip this part. But if this is not your case and yo need to learn the very basis, then keep reading!
– Starting with the interface –
This is how blender looks, just in case!
Oh yes.. Blender looks quite diferent, don’t you think? but belive me, as soon as you start your training you will notice the speed of the workflow and almost every thing will make sense.
Moving and rotating your viewpoint
If you were curious and you tried, maybe you noticed that by pressing Middle Mouse Button (MMB as from now) over the 3D Viewport you were able to rotate the view, and if you press Shift + Middle Mouse Button you can also move the viewpoint.
If you did not, well this is the time to do it, go to the 3D Viewport and try to rotate and move the viewpoint by pressing the MMB, and MMB + Shift button.
What about selecting objects? You were unable to selecf objects and you just wonder why? Well this is because blender works a bit diferent (compared with other aps like 3DMax, Maya and others, just to mention…) so if you try to select an object, for example the “Cube” in the way you used to do for example in 3DMax, or even in Windows or Linux (with -Left Mouse Button- ) you will see that only that red cross is moving, whenever you do the click. So now that you know, try to select objects with the Rigth Mouse Button. Later we will be talk about more about that red cross.
Transform is related to any modification an object recieve respect its 3D Space, wich can be move, rotate and scale. If you noticed every time you start blender the default cube on scene is selected and the move tool is already visible, so by cliking with LMB you can move the object in X, Y or Z depending wich axis you choose. You can also toggle the handler for rotating and scale, and even a combination by pressing Shift+LMB and selecting the transform type you want, as shown in the picture below.
Note: every transform action can be cancelled by pressing LMB or scape key.
If you want, you can use shortcuts: G for Move/Grab, R for Rotate and S for Scale
Get used to work with multiple views
A recomendation about moving objects in blender is to use several views to place any object in the right place. Why? well.. since we are working in a 3D space, we need to see where are they to avoid misplaced objects. It happened to me (some years ago) once while I was teaching in a 3DMax course, a student was making a 3D table, everything was fine until I notice that only in certain angle and position of the perspective view the table looked “fine”, like in the picture below:
In order to avoid this, get used to use the different views (top, side, front, etc) in order to avoid misplaced objects. Look at the picture below to see how I constantly changed the views to place objects on scene.
Note: I’ve used some shortcuts like “Duplicate Object” with Shift+D
Snap tools are also avaliable in blender so you can use it to make object movement more precise, based in blender units. This can help you to even to rotate and scale.
To use this snap tools, simply press “Control Key” from your keyboard and move your object, and you will notice that it will move according the grid lines. For scaling will be similar, and for rotation, its going to be like rotation steps of 5° each one. See the picture below for an example:
In the same way, you can press Shift+move and the movement will be more slow, the same with rotation and scale.
If you need to erase all the information in transform, like move, rotation or scale, simply use the following key combinations: Alt+G to clear movemen, Alt+R to clear rotation, and Alt+S to clear scale.
Perspective VS Ortographic
A perspective view is an approximate representation, on a flat surface (such as a monitor), of an image as it is perceived by the eye. The two most characteristic features of perspective are that objects are drawn:
- Smaller as their distance from the observer increases
- Foreshortened: the size of an object’s dimensions along the line of sight are relatively shorter than dimensions across the line of sight.
In orthographic view every line remains to scale.
Orthographic view Perspective View
It is often easier to construct an object in orthographic view. If two objects are aligned in the 3D space, they are also aligned in the view port if you are in orthographic view. Objects of same size appear with the same size. The camera on the other hand renders by default in perspective view.
- You switch between these two options with View->Orthographic or View->Perspective, or by pressing 5 in the numeric keyboard.
So, what the heck is that “red-white cross” thing? you might be asking…
The Left Mouse Button (LMB as from now) is used to place the 3D Cursor. But what is that for? The 3D Cursor is simply a point in 3D space which can be used for a number of purposes, for example:
- Positioning objects
- Transform (used along with move, rotate, scalate)
- And a lot more..
The 3D Cursor can be placed by clicking with LMB all over the 3d view, but you can also set the coordinates if you want.
And for now we are goint to use the 3D Cursor for positioning objects. So, let’s start!
- First thing to do,start a new scene (press Control+N)
- Now select the lamp, then press Shift and keep it pressed (for multiple selection) while selectin the Camera and the Cube
- Press X in your keyboard to delete the objects
- Make sure the 3D Cursor is in the (0,0,0) coordinates like in the image above.
- Press Shift + A then go to Mesh and add the object called “Plane”
- Once the object “Plane” is on scene, click on its side of the 3d world to place the 3D Cursor right on the side of it, remember to do this in a side view.
- Press Shift+A and now add the object “Cube” object from the same list, and repeat the step 6
- Add all the objects from the list
- you got it!
What is that about? well.. it was simple, you just managed out how to put objects on scene by using the 3D Cursor, because every objects appear where the 3D Cursor is.
Also by making LMB over any object on scene (for example a box) you can also position the 3D cursor, because it now can read the scene dept.
Now try to make a primitive train, like this!
Use all the objects you think you could need to recreate a train.
Until now we were working in Object Mode, and this kind of modifications affect the whole object (move, rorate, scale, etc) and it does not include sub elements. You can notice when working in object mode by looking at the header bar.
To change to edit mode we simply select that mode in the drop down menu, as shown in the picture below:
As you can saw in the picture, we have three modes to edit the geometry (vertex, edge and faces) and you can select it by pressing Control+Tab, or by pressing in the header buttons shown in the picture above.
Next part will be written in a few days, just want to see if this is helpful for you guys , and if not then I will focus in other tasks