Challenge - 5 Problems
Transform Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this position update code?
Consider a Unity GameObject with initial position (1, 2, 3). What will be the new position after running this code snippet?
Unity
transform.position = new Vector3(1, 2, 3); transform.position += new Vector3(0, 5, 0); Debug.Log(transform.position);
Attempts:
2 left
💡 Hint
Adding a Vector3 to position moves the object by that amount.
✗ Incorrect
The initial position is (1,2,3). Adding (0,5,0) moves the object up by 5 units on the y-axis, resulting in (1,7,3).
❓ Predict Output
intermediate2:00remaining
What is the rotation angle after this code runs?
A GameObject starts with rotation (0, 0, 0). After running this code, what is the z-axis rotation in degrees?
Unity
transform.rotation = Quaternion.Euler(0, 0, 45); transform.Rotate(0, 0, 30); float zRotation = transform.rotation.eulerAngles.z; Debug.Log(zRotation);
Attempts:
2 left
💡 Hint
Rotate adds to the current rotation.
✗ Incorrect
Initial rotation is 45 degrees on z. Rotating 30 more degrees results in 75 degrees total.
❓ Predict Output
advanced2:00remaining
What is the scale of the object after this code?
Given a GameObject with initial scale (1, 1, 1), what is the scale after this code runs?
Unity
transform.localScale = new Vector3(2, 2, 2); transform.localScale = Vector3.Scale(transform.localScale, new Vector3(0.5f, 3, 1)); Debug.Log(transform.localScale);
Attempts:
2 left
💡 Hint
Vector3.Scale multiplies each component separately.
✗ Incorrect
Initial scale is (2,2,2). Multiplying by (0.5,3,1) results in (1,6,2).
❓ Predict Output
advanced2:00remaining
What error occurs when running this code?
What error will this code produce when executed in Unity?
Unity
transform.position = new Vector3(1, 2); Debug.Log(transform.position);
Attempts:
2 left
💡 Hint
Vector3 requires three float arguments.
✗ Incorrect
Vector3 constructor requires three floats (x,y,z). Passing only two causes a compile-time error.
🧠 Conceptual
expert3:00remaining
How does changing localScale affect child objects?
If you scale a parent GameObject's transform.localScale to (2, 2, 2), how does it affect its child GameObjects' positions and scales?
Attempts:
2 left
💡 Hint
Think about how scaling a container affects everything inside it.
✗ Incorrect
Scaling a parent affects all children: their local positions are scaled, so they move farther from the parent, and their scales multiply by the parent's scale.