A. You cannot use '+=' operator with velocity; it causes errors.
B. This code instantly adds 5 units upward speed every frame, causing acceleration buildup.
C. Vector3.up is not a valid direction for velocity.
D. Rigidbody velocity cannot be changed directly.
Solution
Step 1: Understand velocity += Vector3.up * 5
This adds 5 units upward speed to current velocity instantly each time it runs.
Step 2: Identify problem in repeated calls
If called every frame, velocity keeps increasing, causing unnatural acceleration buildup.
Final Answer:
This code instantly adds 5 units upward speed every frame, causing acceleration buildup. -> Option B
Quick Check:
Adding velocity each frame causes speed to grow too fast [OK]
Hint: Adding velocity each frame causes speed to grow too fast [OK]
Common Mistakes:
Thinking '+=' on velocity causes syntax errors
Believing Vector3.up is invalid
Assuming velocity cannot be changed directly
5. You want to make a Rigidbody jump smoothly using physics forces, but also limit its maximum upward speed to 10 units per second. Which approach correctly combines forces and velocity control?
hard
A. Use rb.AddForce(Vector3.up * jumpForce) only and ignore velocity limits.
B. Set rb.velocity = Vector3.up * 10 directly every frame without forces.
C. Use rb.AddForce(Vector3.up * jumpForce) and clamp rb.velocity.y to max 10 after applying force.
D. Set rb.velocity = Vector3.up * jumpForce once and never apply forces.
Solution
Step 1: Use AddForce for smooth jumping
Applying AddForce lets physics handle smooth acceleration for jump.
Step 2: Clamp velocity to limit max speed
After applying force, clamp rb.velocity.y to 10 to prevent exceeding max upward speed.
Final Answer:
Use rb.AddForce(Vector3.up * jumpForce) and clamp rb.velocity.y to max 10 after applying force. -> Option C
Quick Check:
Force for smooth jump + clamp velocity to limit speed [OK]
Hint: Combine AddForce with velocity clamp to control max speed [OK]
Common Mistakes:
Setting velocity directly every frame causing unnatural jumps
Ignoring velocity limits causing excessive speed
Using only velocity without forces for smooth physics