0
0
Unityframework~8 mins

Rigidbody forces and velocity in Unity - Performance & Optimization

Choose your learning style9 modes available
Performance: Rigidbody forces and velocity
MEDIUM IMPACT
This concept affects the physics simulation performance and frame rendering smoothness in a Unity game.
Moving a Rigidbody object smoothly and efficiently
Unity
void FixedUpdate() {
  rigidbody.AddForce(new Vector3(5, 0, 0), ForceMode.Force);
}
Using AddForce in FixedUpdate respects physics simulation timing and produces smoother, more natural movement.
📈 Performance GainReduces physics conflicts and jitter, improving frame stability.
Moving a Rigidbody object smoothly and efficiently
Unity
void Update() {
  rigidbody.velocity = new Vector3(5, 0, 0);
}
Setting velocity directly every frame in Update bypasses physics forces and can cause unnatural movement and physics conflicts.
📉 Performance CostTriggers frequent physics recalculations and can cause jitter, impacting frame rate.
Performance Comparison
PatternPhysics CallsFrame UpdatesJitter RiskVerdict
Direct velocity set in UpdateHigh (every frame)High (every frame)High[X] Bad
AddForce in FixedUpdateModerate (fixed timestep)Moderate (fixed timestep)Low[OK] Good
Rendering Pipeline
Rigidbody forces and velocity affect the physics simulation stage before rendering. Physics calculations update object positions, which then update the scene graph for rendering.
Physics Simulation
Transform Update
Render Preparation
⚠️ BottleneckPhysics Simulation
Optimization Tips
1Use FixedUpdate for physics-related Rigidbody changes.
2Avoid setting Rigidbody velocity directly every frame.
3Use AddForce or similar methods to apply movement forces naturally.
Performance Quiz - 3 Questions
Test your performance knowledge
Which method is better for applying continuous movement to a Rigidbody for smooth physics simulation?
AUse AddForce inside FixedUpdate
BSet velocity directly inside Update
CModify transform.position every frame
DUse AddForce inside Update
DevTools: Profiler
How to check: Open Unity Profiler, select Physics module, run the game and observe physics calculation time and frame rate.
What to look for: Look for high physics CPU usage and frame time spikes indicating inefficient Rigidbody updates.