Inferensys

Glossary

Contact Force

A contact force is the force that arises at the interface between two simulated rigid bodies when they collide or touch, decomposed into a normal force perpendicular to the contact surface and a tangential frictional force parallel to it.
Stylish WeWork-like workspace with hot desks and document wall, professional searching through enterprise knowledge base on a mounted ultrawide display, warm industrial pendants overhead.
PHYSICS SIMULATION

What is Contact Force?

In physics-based simulation for robotics, a contact force is the fundamental interaction that occurs when two simulated rigid bodies touch or collide.

A contact force is a force that arises at the interface between two simulated rigid bodies when they collide or touch, decomposed into a normal force perpendicular to the contact surface and a tangential frictional force parallel to it. This decomposition is critical for accurate Sim-to-Real Transfer Learning, as it models the fundamental physical interactions a robot will experience. The normal component prevents interpenetration, while the friction component, often modeled by Coulomb friction, resists sliding motion.

Accurately computing contact forces is the primary task of a physics engine's constraint solver, which solves a Linear Complementarity Problem (LCP) to find non-penetrating, non-adhesive forces. These calculated forces are then fed into the Newton-Euler equations to update the bodies' velocities and positions. High-fidelity contact modeling, including effects like the coefficient of restitution for bounciness, is essential for training robust robotic policies in simulation that will perform reliably on physical hardware.

PHYSICS SIMULATION

Key Components of Contact Force

Contact force is not a single value but a composite vector decomposed into orthogonal components. Its accurate calculation is fundamental for stable, realistic rigid body dynamics in simulation.

01

Normal Force

The normal force is the component perpendicular to the contact surface, arising to prevent interpenetration of rigid bodies. It is calculated based on the penetration depth, material stiffness, and damping.

  • Primary Role: Enforces the non-penetration constraint.
  • Calculation: Often modeled via a spring-damper system in penalty methods or as an inequality constraint in LCP solvers.
  • Direction: Always acts along the contact normal, pushing bodies apart.
02

Tangential Friction Force

The tangential friction force acts parallel to the contact surface, opposing relative sliding motion. It is governed by the Coulomb friction model.

  • Static Friction: Prevents motion initiation. Force magnitude is ≤ μₛ * |Fₙ|, where μₛ is the static friction coefficient.
  • Kinetic Friction: Opposes ongoing sliding. Force magnitude = μₖ * |Fₙ|, where μₖ is the kinetic (dynamic) coefficient.
  • Friction Cone: The set of all allowable friction forces forms a cone around the contact normal; the resultant force must lie within it.
03

Contact Point & Normal

The contact point is the location (or manifold) where force is applied, and the contact normal is the unit vector defining the direction of the normal force.

  • Computation: Determined by the narrow phase of collision detection (e.g., GJK/EPA for convex shapes).
  • Significance: The contact normal defines the local coordinate frame for decomposing the total contact force. An inaccurate normal leads to unrealistic sliding or bouncing.
  • Manifold: For extended contact, multiple points or a contact patch are used to approximate the interaction area.
04

Restitution (Impulsive Force)

Restitution models the elasticity of a collision, generating an impulsive force that causes bodies to bounce apart. It is characterized by the coefficient of restitution (COR).

  • COR Definition: A scalar 0 ≤ e ≤ 1, where e=0 is perfectly inelastic (no bounce) and e=1 is perfectly elastic (maximum bounce).
  • Formula: e = - (v_sep / v_app), the ratio of separation velocity to approach velocity post- and pre-impact.
  • Implementation: Applied as an instantaneous velocity change (impulse) at the moment of collision, separate from continuous contact forces.
05

Constraint-Based Formulation (LCP)

In high-fidelity simulators, contact is formulated as a Linear Complementarity Problem (LCP). This method enforces constraints exactly, unlike penalty methods.

  • Core Principle: The solver finds non-penetrating forces where either the penetration is zero or the normal force is zero (complementarity condition).
  • Friction Cone Approximation: The nonlinear friction cone is often approximated as a polyhedral pyramid for integration into the LCP.
  • Advantage: Produces stable, non-penetrating results without requiring infinitely stiff springs, but is computationally more intensive.
06

Penalty-Based Formulation

The penalty method models contact forces as those from a stiff, damped spring at the penetration point.

  • Spring Force: Proportional to penetration depth (Fₙ = -k * d).
  • Damping Force: Proportional to penetration velocity, providing energy loss (F_damp = -c * v).
  • Trade-offs: Simpler to implement but can cause unrealistic oscillations or require very small time steps for stability if stiffness (k) is high. Allows small, temporary penetrations.
COMPUTATIONAL PHYSICS

How is Contact Force Computed in Simulation?

Contact force computation is the numerical process within a physics engine that determines the repulsive and frictional forces generated when simulated rigid bodies intersect.

A constraint solver, often formulating the problem as a Linear Complementarity Problem (LCP), calculates the minimal normal forces required to prevent inter-penetration over the next time step. This core impulse-based or force-based calculation iteratively satisfies non-penetration constraints while respecting the friction cone defined by Coulomb's law, which bounds the allowable tangential force. Warm starting from the prior solution accelerates convergence.

The computed force is decomposed into perpendicular normal and parallel tangential components. The normal component is derived from material properties and penetration depth, while the tangential frictional component opposes relative sliding motion. High-fidelity simulation for Sim-to-Real Transfer Learning requires accurate modeling of these forces, as errors directly manifest as unstable grasps or unrealistic object dynamics when policies are deployed on physical robots.

CONTACT FORCE

Primary Simulation Methods for Contact

Contact forces are computationally resolved using distinct numerical methods, each with specific trade-offs in accuracy, stability, and performance for robotic simulation.

01

Penalty Method

The penalty method models contact as a stiff, damped spring. When two bodies penetrate, a restorative force is applied proportional to the penetration depth (the spring) and the rate of penetration (the damper).

  • Mechanism: Force = -(stiffness * penetration_depth) - (damping * penetration_velocity)
  • Advantage: Simple to implement and parallelize; computationally inexpensive.
  • Disadvantage: Can cause unrealistic bouncing and requires very high stiffness for realism, leading to numerical instability unless sub-stepping is used.
  • Use Case: Best for non-critical contacts or in real-time applications where absolute physical accuracy is secondary to stability and speed.
02

Impulse-Based Dynamics

Impulse-based dynamics resolves collisions by applying instantaneous changes in velocity (impulses) rather than continuous forces. It directly computes an impulse that satisfies Newton's restitution law and friction at the moment of impact.

  • Mechanism: Solves for an impulse J such that relative velocity post-collision = -COR * relative velocity pre-collision.
  • Advantage: Naturally handles simultaneous collisions and stacking; good for games and interactive simulations.
  • Disadvantage: Can be challenging to stabilize for persistent contact (like resting objects) and may jitter.
  • Example: Used in early physics engines like ODE (Open Dynamics Engine) and many game physics SDKs for fast, plausible collisions.
03

Constraint-Based Method (LCP)

The constraint-based method formulates contact as a set of hard constraints to be solved simultaneously. It prevents penetration (non-interpenetration constraint) and models friction (friction cone constraint), typically framed as a Linear Complementarity Problem (LCP).

  • Mechanism: Solves for contact forces such that: J*v >= 0, f >= 0, f^T * (J*v) = 0. This ensures forces only act when bodies are separating (complementarity).
  • Advantage: Highly accurate and stable for persistent contact and complex stacking scenarios.
  • Disadvantage: Computationally expensive, requiring iterative solvers (e.g., Projected Gauss-Seidel).
  • Use Case: The standard for high-fidelity robotics simulation in engines like Bullet, MuJoCo, and Drake.
04

Position-Based Dynamics (PBD)

Position-Based Dynamics is a geometric method that directly manipulates the positions of particles or vertices to satisfy constraints, including collision and non-penetration.

  • Mechanism: After an initial unconstrained integration step, positions are iteratively projected onto the manifold of valid states defined by constraints (e.g., |p1 - p2| >= radius1 + radius2).
  • Advantage: Unconditionally stable, highly controllable, and free from overshooting issues common in force-based methods.
  • Disadvantage: Not strictly physically accurate in terms of energy conservation; more of a kinematic solver.
  • Example: Extensively used in real-time cloth, soft body, and fluid simulation, and in some robotic simulators for its robustness.
05

Smooth Contact Models

Smooth contact models approximate the discontinuous nature of contact (which makes a binary on/off state) with a continuous, differentiable function. This is crucial for gradient-based optimization and reinforcement learning.

  • Mechanism: Uses a smoothed force function like a sigmoid or spring that activates gradually as distance approaches zero, e.g., force = (k / (d + ε)) for small distances d.
  • Advantage: Enables the use of efficient gradient-based optimizers and allows backpropagation through physics for training.
  • Disadvantage: Introduces physical inaccuracy at the moment of "true" contact; forces act before geometries actually touch.
  • Use Case: Found in differentiable physics engines like Nimble, Brax, and JAX-based simulators used for policy learning.
06

Hybrid Methods

Many modern high-performance physics engines use hybrid methods that combine techniques to leverage their respective strengths, often using different solvers for different types of constraints.

  • Common Pattern: Use a fast impulse-based or PBD solver for broad-phase collision and simple contacts, and a more accurate iterative LCP solver (like Sequential Impulses) for precise, stable resolution of persistent contact and friction.
  • Warm Starting: A key hybrid technique where the solver initializes its solution for the current time step with the forces/impulses from the previous step, dramatically improving convergence.
  • Example: Bullet Physics uses a Projected Gauss-Seidel (PGS) solver, which is an iterative method for solving the LCP, effectively blending constraint and impulse-based concepts for robust performance.
CONTACT FORCE

Frequently Asked Questions

A contact force is a fundamental concept in physics simulation, representing the interaction at the interface between two rigid bodies. In robotics and digital twin development, accurately modeling these forces is critical for training robust control policies in simulation before safe physical deployment.

A contact force is a force that arises at the interface between two simulated rigid bodies when they collide or touch. It is computationally decomposed into two orthogonal components: a normal force acting perpendicular to the contact surface, which prevents interpenetration, and a tangential frictional force acting parallel to the surface, which resists sliding motion. In simulation engines, these forces are calculated by a constraint solver to satisfy non-penetration conditions and Coulomb friction laws, forming the basis for realistic physical interaction in virtual training environments for robotics.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.