0
0
Unityframework~20 mins

Rigidbody forces and velocity in Unity - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
šŸŽ–ļø
Rigidbody Force Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
ā“ Predict Output
intermediate
2:00remaining
What is the velocity after applying force with ForceMode.Force?
Consider a Rigidbody with mass 2 kg initially at rest. You apply a force of (4, 0, 0) using ForceMode.Force for one fixed update frame. What will be the velocity of the Rigidbody after this frame?
Unity
Rigidbody rb = GetComponent<Rigidbody>();
rb.mass = 2f;
rb.velocity = Vector3.zero;
Vector3 force = new Vector3(4f, 0f, 0f);
rb.AddForce(force, ForceMode.Force);
// Assume fixedDeltaTime = 0.02 seconds
AVelocity will be (0.04, 0, 0)
BVelocity will be (2, 0, 0)
CVelocity will be (4, 0, 0)
DVelocity will be (0.02, 0, 0)
Attempts:
2 left
šŸ’” Hint
Remember ForceMode.Force applies force over time, so velocity changes by acceleration * deltaTime.
ā“ Predict Output
intermediate
2:00remaining
What is the velocity after applying force with ForceMode.Impulse?
A Rigidbody with mass 3 kg is at rest. You apply an impulse force of (6, 0, 0) using ForceMode.Impulse. What is the velocity immediately after applying this impulse?
Unity
Rigidbody rb = GetComponent<Rigidbody>();
rb.mass = 3f;
rb.velocity = Vector3.zero;
Vector3 impulse = new Vector3(6f, 0f, 0f);
rb.AddForce(impulse, ForceMode.Impulse);
AVelocity will be (2, 0, 0)
BVelocity will be (0, 0, 0)
CVelocity will be (6, 0, 0)
DVelocity will be (0.02, 0, 0)
Attempts:
2 left
šŸ’” Hint
Impulse changes velocity immediately by impulse / mass.
šŸ”§ Debug
advanced
2:00remaining
Why does velocity not change after AddForce with ForceMode.Acceleration?
You have this code snippet: Rigidbody rb = GetComponent(); rb.velocity = Vector3.zero; rb.AddForce(new Vector3(10, 0, 0), ForceMode.Acceleration); But after running, velocity remains zero. What is the most likely reason?
Unity
Rigidbody rb = GetComponent<Rigidbody>();
rb.velocity = Vector3.zero;
rb.AddForce(new Vector3(10, 0, 0), ForceMode.Acceleration);
AForceMode.Acceleration requires mass to be zero to work.
BThe Rigidbody is set to kinematic, so forces don't affect velocity.
CAddForce with ForceMode.Acceleration only works in FixedUpdate, not Update.
DVelocity is reset to zero immediately after AddForce.
Attempts:
2 left
šŸ’” Hint
Check Rigidbody settings that disable physics simulation.
🧠 Conceptual
advanced
2:00remaining
How does ForceMode.VelocityChange differ from ForceMode.Impulse?
Which statement correctly describes the difference between ForceMode.VelocityChange and ForceMode.Impulse when applied to a Rigidbody?
ABoth apply force ignoring mass but at different time intervals.
BVelocityChange applies a continuous force; Impulse applies a one-time force.
CImpulse ignores mass and changes velocity directly; VelocityChange applies force considering mass.
DVelocityChange ignores mass and changes velocity directly; Impulse applies force considering mass.
Attempts:
2 left
šŸ’” Hint
Think about how mass affects velocity change in each mode.
ā“ Predict Output
expert
3:00remaining
What is the final velocity after multiple AddForce calls with different ForceModes?
A Rigidbody with mass 4 kg starts at zero velocity. The following code runs in one FixedUpdate: rb.AddForce(new Vector3(8, 0, 0), ForceMode.Force); rb.AddForce(new Vector3(4, 0, 0), ForceMode.Impulse); rb.AddForce(new Vector3(2, 0, 0), ForceMode.VelocityChange); Assuming fixedDeltaTime = 0.02 seconds, what is the final velocity vector?
Unity
Rigidbody rb = GetComponent<Rigidbody>();
rb.mass = 4f;
rb.velocity = Vector3.zero;
rb.AddForce(new Vector3(8f, 0f, 0f), ForceMode.Force);
rb.AddForce(new Vector3(4f, 0f, 0f), ForceMode.Impulse);
rb.AddForce(new Vector3(2f, 0f, 0f), ForceMode.VelocityChange);
AVelocity will be (4.02, 0, 0)
BVelocity will be (3.5, 0, 0)
CVelocity will be (3.04, 0, 0)
DVelocity will be (1.5, 0, 0)
Attempts:
2 left
šŸ’” Hint
Calculate velocity changes from each AddForce separately and sum them.