Learn to control position, rotation (Euler and Quaternion), scale, and object hierarchy through the Inspector and scripts in Unity.
Create a new 3D scene. It will contain:
- A platform (Cube)
- A red cube (ChildCube)
- A blue cube (EnemyCube)
- An empty parent object (ParentHolder)
- Create
ParentHolder(Create Empty). - Make
ChildCube(red cube) a child ofParentHolder(drag in the Hierarchy). - Set
ChildCube's local position relative toParentHolder:(1, 0, 0). - Move
ParentHolderto(3, 2, 0). Where doesChildCubeend up? (Answer: at world position(4, 2, 0)).
- Place
EnemyCube(blue cube) at position(0, 1, 5). - Rotate it around the Y axis by
45°via the Inspector (Euler). - Write a short script
RotateEnemythat inUpdate()increasestransform.eulerAngles.yby30°every second. Attach it toEnemyCube.
- Create an empty object
Targetat position(2, 1, 0). - Write a script
FaceTargetforChildCube: useQuaternion.LookRotationso that the red cube always facesTarget. Do not use Euler. - Test: move
Targetwith the mouse in Scene View —ChildCubeshould rotate instantly.
- Set
ParentHolder's scale to(2, 1, 1). - Print to the console (
Debug.Log) the global scale (transform.lossyScale) forChildCube. Explain why it is not(1,1,1). - Change
ChildCube's local scale to(0.5, 1, 1). Calculate the final X size manually.
- Write an
Orbitscript that rotatesChildCubearoundParentHolderin a circle usingtransform.RotateAround. Parameters: speed 30° per second, Y axis.
- Scripts
RotateEnemy,FaceTarget,Orbit(if done). - Console output values (task 4) and the answer to the
lossyScalequestion.