0
0
Unityframework~10 mins

Rigidbody 3D component in Unity - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to add a Rigidbody component to the GameObject.

Unity
gameObject.AddComponent<[1]>();
Drag options to blanks, or click blank then click option'
AMeshRenderer
BCollider
CTransform
DRigidbody
Attempts:
3 left
💡 Hint
Common Mistakes
Using Collider instead of Rigidbody.
Trying to add Transform component which already exists.
2fill in blank
medium

Complete 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'
Avelocity
Bmass
Cdrag
DangularVelocity
Attempts:
3 left
💡 Hint
Common Mistakes
Setting velocity instead of mass.
Using drag which affects air resistance.
3fill in blank
hard

Fix 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'
Anew Vector3(0, 10, 0)
BVector3.up * 10
Cnew Vector4(0, 10, 0, 0)
Dnew Vector2(0, 10)
Attempts:
3 left
💡 Hint
Common Mistakes
Using Vector2 which is 2D vector.
Using Vector4 which is not valid for AddForce.
4fill in blank
hard

Fill 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'
ARigidbody
BCollider
CuseGravity
DisKinematic
Attempts:
3 left
💡 Hint
Common Mistakes
Using Collider instead of Rigidbody.
Setting isKinematic instead of useGravity.
5fill in blank
hard

Fill 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'
ARigidbody
B<
CVector3.up * 10
DCollider
Attempts:
3 left
💡 Hint
Common Mistakes
Using Collider instead of Rigidbody.
Using '>' instead of '<' in the condition.
Adding force with wrong vector type.