Bird
Raised Fist0
Unityframework~20 mins

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

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
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.

Practice

(1/5)
1. What is the main purpose of adding a Rigidbody component to a 3D object in Unity?
easy
A. To make the object invisible
B. To change the object's color
C. To make the object respond to physics like gravity and collisions
D. To add sound effects to the object

Solution

  1. Step 1: Understand Rigidbody role

    The Rigidbody component allows objects to move and react using physics rules like gravity and collisions.
  2. Step 2: Compare options

    Only To make the object respond to physics like gravity and collisions describes physics behavior, others are unrelated to Rigidbody.
  3. Final Answer:

    To make the object respond to physics like gravity and collisions -> Option C
  4. Quick Check:

    Rigidbody = physics control [OK]
Hint: Rigidbody = physics behavior for 3D objects [OK]
Common Mistakes:
  • Confusing Rigidbody with visual or audio components
  • Thinking Rigidbody changes appearance
  • Assuming Rigidbody disables collisions
2. Which of the following is the correct way to access the Rigidbody component in a Unity C# script attached to the same GameObject?
easy
A. Rigidbody rb = FindObjectOfType<Rigidbody>();
B. Rigidbody rb = GetComponent<Rigidbody>();
C. Rigidbody rb = GetComponent<Collider>();
D. Rigidbody rb = new Rigidbody();

Solution

  1. Step 1: Identify correct method to get Rigidbody

    Use GetComponent<Rigidbody>() to get Rigidbody on the same GameObject.
  2. Step 2: Check other options

    Rigidbody rb = GetComponent<Collider>(); gets Collider, not Rigidbody. Rigidbody rb = FindObjectOfType<Rigidbody>(); finds any Rigidbody in scene, not necessarily on this object. Rigidbody rb = new Rigidbody(); creates a new Rigidbody instance, which is incorrect.
  3. Final Answer:

    Rigidbody rb = GetComponent<Rigidbody>(); -> Option B
  4. Quick Check:

    GetComponent<Rigidbody>() = correct access [OK]
Hint: Use GetComponent<Rigidbody>() to access Rigidbody on same object [OK]
Common Mistakes:
  • Using GetComponent<Collider>() instead of Rigidbody
  • Creating new Rigidbody with new keyword
  • Using FindObjectOfType which is less specific
3. Consider this C# code in Unity:
void Start() {
  Rigidbody rb = GetComponent<Rigidbody>();
  rb.useGravity = false;
  rb.AddForce(new Vector3(0, 10, 0), ForceMode.Impulse);
}
What will happen to the object when the game starts?
medium
A. The object will jump up with an impulse and stay in the air without falling
B. The object will jump up with an impulse and then fall due to gravity
C. The object will not move at all
D. The object will fall down immediately without jumping

Solution

  1. Step 1: Analyze Rigidbody settings

    Setting useGravity = false disables gravity effect on the object.
  2. Step 2: Analyze AddForce effect

    Adding an impulse force upwards makes the object jump up instantly.
  3. Step 3: Combine effects

    Since gravity is off, the object will jump up but not fall back down.
  4. Final Answer:

    The object will jump up with an impulse and stay in the air without falling -> Option A
  5. Quick Check:

    useGravity false + impulse = jump up, no fall [OK]
Hint: useGravity false means no falling after force applied [OK]
Common Mistakes:
  • Assuming gravity still pulls object down
  • Thinking AddForce alone moves object continuously
  • Confusing ForceMode types
4. You wrote this code but the object does not move as expected:
void Update() {
  Rigidbody rb = GetComponent<Rigidbody>();
  rb.velocity = new Vector3(0, 5, 0);
}
What is the likely problem?
medium
A. The Rigidbody component is missing on the object
B. You need to call rb.MovePosition() instead of setting velocity
C. The velocity vector is incorrect; it should be (5, 0, 0)
D. Setting velocity in Update causes physics conflicts; should use FixedUpdate

Solution

  1. Step 1: Understand Rigidbody physics update timing

    Physics updates happen in FixedUpdate, not Update. Setting velocity in Update can cause inconsistent behavior.
  2. Step 2: Identify correct method

    Velocity changes should be done inside FixedUpdate for smooth physics simulation.
  3. Final Answer:

    Setting velocity in Update causes physics conflicts; should use FixedUpdate -> Option D
  4. Quick Check:

    Use FixedUpdate for Rigidbody velocity changes [OK]
Hint: Change Rigidbody velocity inside FixedUpdate, not Update [OK]
Common Mistakes:
  • Forgetting Rigidbody component is required
  • Changing velocity in Update instead of FixedUpdate
  • Confusing velocity vector directions
5. You want to create a bouncing ball that loses some speed each bounce using Rigidbody. Which combination of Rigidbody properties and methods should you use to achieve this realistic effect?
hard
A. Set Rigidbody's drag to a small positive value and use Physics Material with bounciness less than 1
B. Set Rigidbody's useGravity to false and apply upward force every frame
C. Set Rigidbody's isKinematic to true and move the ball manually in Update
D. Disable Rigidbody and use Transform.Translate to simulate bouncing

Solution

  1. Step 1: Understand bouncing with physics

    Bouncing requires gravity, collision response, and energy loss over time.
  2. Step 2: Use drag and physics material

    Setting drag slows the ball gradually. Physics Material's bounciness controls bounce height and energy loss.
  3. Step 3: Evaluate other options

    Set Rigidbody's useGravity to false and apply upward force every frame disables gravity, so no natural bounce. Set Rigidbody's isKinematic to true and move the ball manually in Update disables physics simulation. Disable Rigidbody and use Transform.Translate to simulate bouncing ignores physics entirely.
  4. Final Answer:

    Set Rigidbody's drag to a small positive value and use Physics Material with bounciness less than 1 -> Option A
  5. Quick Check:

    Drag + bounciness < 1 = realistic bounce loss [OK]
Hint: Use drag and physics material bounciness < 1 for realistic bounce [OK]
Common Mistakes:
  • Turning off gravity disables bouncing
  • Making Rigidbody kinematic stops physics
  • Using Transform.Translate ignores physics