0
0
Unityframework~20 mins

Rigidbody 3D component in Unity - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Rigidbody 3D Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of this Rigidbody velocity code?

Consider this Unity C# script snippet attached to a GameObject with a Rigidbody component:

void Start() {
    Rigidbody rb = GetComponent();
    rb.velocity = new Vector3(0, 10, 0);
    Debug.Log(rb.velocity.y);
}

What will be printed in the console when the game starts?

Unity
void Start() {
    Rigidbody rb = GetComponent<Rigidbody>();
    rb.velocity = new Vector3(0, 10, 0);
    Debug.Log(rb.velocity.y);
}
ANullReferenceException
BVector3(0, 10, 0)
C10
D0
Attempts:
2 left
💡 Hint

Remember that rb.velocity is a Vector3 representing speed in each direction.

🧠 Conceptual
intermediate
1:30remaining
Which Rigidbody property controls if gravity affects the object?

In Unity's Rigidbody 3D component, which property determines whether the object is affected by gravity?

Adrag
BisKinematic
Cmass
DuseGravity
Attempts:
2 left
💡 Hint

Think about the property that toggles gravity on or off.

🔧 Debug
advanced
2:30remaining
Why does this Rigidbody not move when force is applied?

Look at this code snippet:

void Start() {
    Rigidbody rb = GetComponent();
    rb.isKinematic = true;
    rb.AddForce(new Vector3(0, 500, 0));
}

Why does the Rigidbody not move when the game runs?

ABecause <code>isKinematic</code> is true, physics forces are ignored
BBecause the force vector is too small to move the object
CBecause <code>AddForce</code> must be called in Update, not Start
DBecause the Rigidbody component is missing
Attempts:
2 left
💡 Hint

Check what isKinematic does to Rigidbody behavior.

📝 Syntax
advanced
2:00remaining
Which code correctly applies an impulse force to a Rigidbody?

Choose the correct C# code snippet to apply an impulse force upwards to a Rigidbody named rb:

Arb.AddForce(new Vector3(0, 10, 0), ForceMode.Impulse);
Brb.AddForce(new Vector3(0, 10, 0), ForceMode.Force);
Crb.AddForce(new Vector3(0, 10, 0));
Drb.AddImpulse(new Vector3(0, 10, 0));
Attempts:
2 left
💡 Hint

Impulse force applies an instant push. Check the ForceMode enum.

🚀 Application
expert
3:00remaining
How many Rigidbody components are active after this code runs?

Given a GameObject with two Rigidbody components attached (which is unusual but possible), and this code runs:

void Start() {
    Rigidbody[] rbs = GetComponents();
    foreach (var rb in rbs) {
        rb.isKinematic = true;
    }
    rbs[0].isKinematic = false;
}

How many Rigidbody components will be affected by physics (not kinematic) after Start?

A0
B1
C2
DCannot have two Rigidbody components on one GameObject
Attempts:
2 left
💡 Hint

Think about how the loop sets all to kinematic, then one is set back.