==================== Rotate/move/assemble ==================== .. index:: manipulate objects .. index:: rotation, Eulerrotation, transformation (location) .. |a| image:: /images/all/blender-basics/d_composed_pices/assemble.png Objectives ========== .. tabularcolumns:: | c | l | :border: none +-------+-------------------------------------------------------------------------+ | |a| | Creating new Objects is easy, afterwards we have to scale and move the | | | pieces to a new location. How this can achieved is shown and | | | explained in this station. | +-------+-------------------------------------------------------------------------+ Instructions ============ :Tasks: 1. Move the pieces of the example to a different place. 2. Join the pieces to a single one and name it »marsmobil«. 3. Create the following object, shown in this picture: .. image:: /images/all/blender-basics/d_composed_pices/camera.png 4. | Create your own object. Creating objects ================ The complete script, parts of the script are explained afterwards. .. literalinclude:: files/mars_mobile.py :language: python How it works ============ Every function is solving a particular problem. You can test the different functions if you comment or uncomment the function calls at the end of the script. The first step is creating all objects. It is important to name the objects. .. image:: /images/all/blender-basics/d_composed_pices/all_pieces.png :width: 500px | You have to distinguish between selected objects an one *active object*. Many objects can be selected, but only one at the time can be the *active one* .. image:: /images/all/blender-basics/d_composed_pices/active-object.png :width: 500px | How many objects are selected, is visible in the info window. .. image:: /images/all/blender-basics/d_composed_pices/objectcount1.png Select objects ============== .. literalinclude:: files/mars_mobile.py :language: python :lines: 39-44 Activate an object ================== Manipulations are only possible with the active object. .. literalinclude:: files/mars_mobile.py :language: python :lines: 46-50 Scale objectes ============== Scaling an object is possible in tree dimensions. If no scaling should happened, the scaling factor is 1. In our example only the z-achs is scaled. Afterwards we move the center of the objects, therefore they are positioned on the ground again. .. literalinclude:: files/mars_mobile.py :language: python :lines: 52-59 Both cylinders are minimized. .. literalinclude:: files/mars_mobile.py :language: python :lines: 61-73 Rotation with Euler =================== All objects are scaled and in the next step they can be assembled. Some parts have to be rotated. We calculate the value once: :: pi_half = 3.141592/2 and use it as often as needed and *pi_half*. It is always a rotation of 90°. :: obj.rotation_euler = [pi_half, 0, 0] More about calculating a rotation is explained at :ref:`Rotating an object ` Now we have finished our prototype and the next car race at the mars can start :-) .. image:: /images/all/blender-basics/d_composed_pices/mars_mobile.png .. todo:: translate station *eurlerrotaton* linked from here...