Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to add a Rigidbody component to the GameObject.
Unity
gameObject.AddComponent<[1]>(); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Collider instead of Rigidbody.
Trying to add Transform component which already exists.
✗ Incorrect
The Rigidbody component is added to enable physics on the GameObject.
2fill in blank
mediumComplete the code to set the Rigidbody's mass to 5.
Unity
Rigidbody rb = GetComponent<Rigidbody>(); rb.[1] = 5f;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Setting velocity instead of mass.
Using drag which affects air resistance.
✗ Incorrect
The mass property sets how heavy the Rigidbody is.
3fill in blank
hardFix the error in the code to apply a force to the Rigidbody.
Unity
Rigidbody rb = GetComponent<Rigidbody>();
rb.AddForce([1]); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Vector2 which is 2D vector.
Using Vector4 which is not valid for AddForce.
✗ Incorrect
The AddForce method requires a Vector3 for 3D forces.
4fill in blank
hardFill both blanks to create a Rigidbody and set it to use gravity.
Unity
Rigidbody rb = gameObject.AddComponent<[1]>(); rb.[2] = true;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Collider instead of Rigidbody.
Setting isKinematic instead of useGravity.
✗ Incorrect
First, add a Rigidbody component, then enable useGravity to let it fall.
5fill in blank
hardFill all three blanks to apply an upward force only if the Rigidbody's velocity is less than 5.
Unity
Rigidbody rb = GetComponent<[1]>(); if (rb.velocity.magnitude [2] 5) { rb.AddForce([3]); }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Collider instead of Rigidbody.
Using '>' instead of '<' in the condition.
Adding force with wrong vector type.
✗ Incorrect
Get the Rigidbody component, check if speed is less than 5, then add upward force.