constraints and collisions

56
Constraints and Collisions Steve Rotenberg CSE291: Physics Simulation UCSD Spring 2019

Upload: others

Post on 22-Mar-2022

3 views

Category:

Documents


0 download

TRANSCRIPT

Constraints and Collisions

Steve Rotenberg CSE291: Physics Simulation

UCSD Spring 2019

Rotational Inertia

β€’ The rotational inertia tensor 𝐈 is a 3x3 symmetric matrix that is essentially the rotational equivalent of mass

β€’ It relates the angular momentum 𝐋 of a rigid body to its angular velocity π›š by the equation

𝐋 = 𝐈 β‹… π›š

β€’ This is similar to how mass relates linear momentum to

linear velocity with 𝐩 = π‘šπ―, but adds additional complexity because 𝐈 is not only a matrix instead of a scalar, but it also changes over time as the object rotates

Principal Axes & Inertias

β€’ If we diagonalize the 𝐈 matrix, we get an orientation matrix 𝐀 and a constant diagonal matrix 𝐈0

𝐈 = 𝐀 β‹… 𝐈0 β‹… 𝐀𝑇

β€’ The matrix 𝐀 rotates the object from an orientation where the principal axes line up with the x, y, and z axes

β€’ The three diagonal values in 𝐈0, (namely 𝐼π‘₯, 𝐼𝑦, and 𝐼𝑧) are the principal inertias. They represent the resistance to torque around the corresponding principal axis (in a similar way that mass represents the resistance to force)

Rigid Body Dynamics

β€’ The center of mass of a rigid body behaves like a particle: – Position: 𝐱

– Velocity: 𝐯 =𝑑𝐱

𝑑𝑑

– Acceleration: 𝐚 =𝑑𝐯

𝑑𝑑=

𝑑2𝐱

𝑑𝑑2

– Mass: π‘š

– Momentum: 𝐩 = π‘šπ―

– Force: 𝐟 =𝑑𝐩

𝑑𝑑= π‘šπš

Rigid Body Dynamics

β€’ Rigid bodies have additional properties for rotation: – Orientation: 𝐀

– Angular velocity: π›š

– Angular acceleration: π›š =π‘‘π›š

𝑑𝑑

– Rotational inertia: 𝐈 = 𝐀 β‹… 𝐈0 β‹… 𝐀𝑇

– Angular momentum: 𝐋 = 𝐈 β‹… π›š

– Torque: 𝛕 =𝑑𝐋

𝑑𝑑= π›šΓ— 𝐈 β‹… π›š + 𝐈 β‹… π›š

Applied Forces

β€’ When we apply a force to a rigid body at some position π±π‘Ÿ, this is equivalent to applying the same force on the center of mass as well as a torque equal to 𝐫 Γ— 𝐟, where 𝐫 = π±π‘Ÿ βˆ’ 𝐱 and 𝐱 is the position of the center of mass of the rigid body

β€’ Various forces can apply to a rigid body and they are just summed up as a single total force and torque:

πŸπ‘‘π‘œπ‘‘π‘Žπ‘™ = πŸπ‘–

π›•π‘‘π‘œπ‘‘π‘Žπ‘™ = 𝐫𝑖 Γ— πŸπ‘–

Newton-Euler Equations

β€’ The Newton-Euler equations describe the motion of a rigid body under applied force and torque:

𝐟 = π‘šπš 𝛕 = π›š Γ— 𝐈 β‹… π›š + 𝐈 β‹… π›š β€’ Solved for acceleration: 𝐚 = 𝐟 π‘š π›š = πˆβˆ’1 𝛕 βˆ’ π›š Γ— 𝐈 β‹… π›š

Kinematics of an Offset Point

β€’ Kinematic equations for an offset point on a rigid body:

π±π‘Ÿ = 𝐱 + 𝐫

π―π‘Ÿ = 𝐯 +π›š Γ— 𝐫

πšπ‘Ÿ = 𝐚 +π›š Γ— 𝐫 +π›š Γ— π›šΓ— 𝐫

𝐱 𝐫

π±π‘Ÿ = 𝐱 + 𝐫

Offset Forces

β€’ If we apply a force 𝐟 to a rigid body at offset 𝐫1, what is the resulting acceleration 𝐚 at offset 𝐫2?

𝐟

𝐚 =?

𝐫𝟏

𝐫𝟐

Inverse Mass Matrix

𝐚 =1

π‘šπŸ βˆ’ 𝐫2 β‹… πˆβˆ’1 β‹… 𝐫1 β‹… 𝐟

𝐚 =1 π‘š 0 00 1 π‘š 00 0 1 π‘š

βˆ’ 𝐫2 β‹… πˆβˆ’1 β‹… 𝐫1 β‹… 𝐟

𝐚 = πŒβˆ’1 β‹… 𝐟

πŒβˆ’1 =1 π‘š 0 00 1 π‘š 00 0 1 π‘š

βˆ’ 𝐫2 β‹… πˆβˆ’1 β‹… 𝐫1

Rigid Pendulum

Rigid Pendulum

β€’ Consider a rigid body pendulum constrained at point π±π‘Ÿ with a ball-and-socket joint (3-DOF rotation)

β€’ We assume that various known forces πŸπ‘˜π‘›π‘œπ‘€π‘› are acting on the rigid body, such as gravity

β€’ The joint is able to apply whatever force πŸπ‘—π‘œπ‘–π‘›π‘‘ that is necessary to keep the offset point of the rigid body stationary

β€’ We need to solve for the unknown constraint force πŸπ‘—π‘œπ‘–π‘›π‘‘

π±π‘Ÿ

𝐫

𝐱

πŸπ‘˜π‘›π‘œπ‘€π‘›

πŸπ‘—π‘œπ‘–π‘›π‘‘

Rigid Pendulum

β€’ To evaluate all forces at a particular instant:

– We first evaluate all known forces on the rigid body (gravity, air friction, joint friction, etc.)

– Next, we can determine what the acceleration πšπ‘Ÿ of the offset point π±π‘Ÿ would be with no constraint

– Then, we can use the inverse mass matrix to solve for the joint force needed to counteract the acceleration and hold the joint together

Offset Acceleration

β€’ Assuming a known total force πŸπ‘˜π‘›π‘œπ‘€π‘› and torque π›•π‘˜π‘›π‘œπ‘€π‘› are acting on the rigid body, we can calculate the acceleration πšπ‘Ÿ at relative offset 𝐫 as:

𝐚 = πŸπ‘˜π‘›π‘œπ‘€π‘› π‘š

π›š = πˆβˆ’1 π›•π‘˜π‘›π‘œπ‘€π‘› βˆ’π›šΓ— 𝐈 β‹… π›š

πšπ‘Ÿ = 𝐚 +π›š Γ— 𝐫 +π›š Γ— π›šΓ— 𝐫

Joint Force

β€’ We need a joint force that will be applied at relative offset 𝐫 and must cancel out the acceleration πšπ‘Ÿ (at the same place)

β€’ We can construct an inverse mass matrix πŒβˆ’1 using 𝐫 for both offsets

πŒβˆ’1 =1 π‘š 0 00 1 π‘š 00 0 1 π‘š

βˆ’ 𝐫 β‹… πˆβˆ’1 β‹… 𝐫

β€’ We then invert it to get the mass matrix 𝐌 β€’ We can then solve for the joint force needed to cancel out the

acceleration πšπ‘Ÿ

πŸπ‘—π‘œπ‘–π‘›π‘‘ = βˆ’πŒ β‹… πšπ‘Ÿ

Joint Force

β€’ Once we have the joint force, we apply it to the rigid body just as any other force, thus finishing the summation of the total force and torque

β€’ We can then use the total force and torque to integrate the motion forward

Rigid Pendulum Force Computation 1. Apply known forces

πŸπ‘˜π‘›π‘œπ‘€π‘› = πŸπ‘–

π›•π‘˜π‘›π‘œπ‘€π‘› = 𝐫𝑖 Γ— πŸπ‘–

2. Compute separation acceleration at joint

𝐚 = πŸπ‘˜π‘›π‘œπ‘€π‘› π‘š

π›š = πˆβˆ’1 π›•π‘˜π‘›π‘œπ‘€π‘› βˆ’π›šΓ— 𝐈 β‹… π›š

πšπ‘Ÿ = 𝐚 +π›š Γ— 𝐫 + π›šΓ— π›šΓ— 𝐫

3. Build inverse mass matrix

πŒβˆ’1 =1 π‘š 0 00 1 π‘š 00 0 1 π‘š

βˆ’ 𝐫 β‹… πˆβˆ’1 β‹… 𝐫

4. Solve joint constraint force

𝐌 = πŒβˆ’1 βˆ’1

πŸπ‘—π‘œπ‘–π‘›π‘‘ = βˆ’πŒ β‹… πšπ‘Ÿ

5. Compute total force & torque

πŸπ‘‘π‘œπ‘‘π‘Žπ‘™ = πŸπ‘˜π‘›π‘œπ‘€π‘› + πŸπ‘—π‘œπ‘–π‘›π‘‘

π›•π‘‘π‘œπ‘‘π‘Žπ‘™ = π›•π‘˜π‘›π‘œπ‘€π‘› + 𝐫 Γ— πŸπ‘—π‘œπ‘–π‘›π‘‘

𝐫

πŸπ‘˜π‘›π‘œπ‘€π‘›

πŸπ‘—π‘œπ‘–π‘›π‘‘

πŸπ‘‘π‘œπ‘‘π‘Žπ‘™

Joint Error

β€’ Unfortunately, there’s a catch…

β€’ The problem is that the joint forces are changing continuously, and so the finite time integration will accumulate a small error on every step

β€’ An error in the integration of the second derivative means that the first derivative (velocity) and the zeroth derivative (position) will accumulate error

β€’ This error shows up as a non-zero velocity at the joint and as a gap in position as well

Joint Error

β€’ There are several options for correcting the error:

– Penalty forces

– Impulse to correct velocity

– β€˜Push’ to correct position

– Construct as kinematic hierarchy

Articulated Bodies

Double Pendulum

β€’ Consider the double pendulum

β€’ Known force πŸπ‘˜1 acts on body 1 and known force πŸπ‘˜2 acts on body 2

β€’ We need to simultaneously solve for joint forces πŸπ‘—1 and πŸπ‘—2

that hold both joints together πŸπ‘˜1

πŸπ‘—1

πŸπ‘˜2

πŸπ‘—2

βˆ’πŸπ‘—2

π‘π‘œπ‘‘π‘¦ 1

π‘π‘œπ‘‘π‘¦ 2

π‘—π‘œπ‘–π‘›π‘‘ 2

π‘—π‘œπ‘–π‘›π‘‘ 1

Notation

β€’ We define π«π‘Žπ‘ as the offset from the center of mass of body π‘Ž to joint 𝑏

β€’ We will define πŒπ‘Žπ‘π‘βˆ’1 to be

the inverse mass matrix computed for body π‘Ž, that relates the force applied at joint 𝑏 to the acceleration at joint 𝑐

π‘π‘œπ‘‘π‘¦ 1

π‘π‘œπ‘‘π‘¦ 2

π‘—π‘œπ‘–π‘›π‘‘ 2

π‘—π‘œπ‘–π‘›π‘‘ 1

𝐫11

𝐫12

𝐫22

Known Accelerations

β€’ The accelerations of the first body due to known force and torque are:

𝐚1 = πŸπ‘˜1 π‘š1

π›š 1 = 𝐈1βˆ’1 π›•π‘˜1 βˆ’π›š1 Γ— 𝐈1 β‹… π›š1

πšπ‘Ÿ11 = 𝐚1 +π›š 1 Γ— 𝐫11 +π›š1 Γ— π›š1 Γ— 𝐫11 πšπ‘Ÿ12 = 𝐚1 +π›š 1 Γ— 𝐫12 +π›š1 Γ— π›š1 Γ— 𝐫12

β€’ And for the second body: 𝐚2 = πŸπ‘˜2 π‘š2

π›š 2 = 𝐈2βˆ’1 π›•π‘˜2 βˆ’π›š2 Γ— 𝐈2 β‹… π›š2

πšπ‘Ÿ22 = 𝐚2 +π›š 2 Γ— 𝐫22 +π›š2 Γ— π›š2 Γ— 𝐫22

Separation Acceleration

β€’ For a particular joint, we’re actually interested in the acceleration that the two bodies are potentially separating

β€’ In other words, we want the difference between the offset accelerations of the two connected bodies at the joint

β€’ By definition, we will choose the sign such that we subtract the lower numbered body’s offset acceleration from the higher numbered body’s

β€’ Also, for we’ll assign body 0 as the fixed coordinate system β€’ Therefore, we get the two joint separation accelerations:

πšπ‘—1 = πšπ‘Ÿ11 πšπ‘—2 = πšπ‘Ÿ22 βˆ’ πšπ‘Ÿ12

Joint Forces

β€’ The separation acceleration at joint 1 resulting from joint forces will be the sum of accelerations due to πŸπ‘—1 and βˆ’πŸπ‘—2

β€’ The acceleration at joint 1 due to joint forces will be:

πšπ‘—1β€² = 𝐌111

βˆ’1 β‹… πŸπ‘—1 +𝐌121βˆ’1 β‹… βˆ’πŸπ‘—2

πšπ‘—1β€² = 𝐌111

βˆ’1 β‹… πŸπ‘—1 βˆ’πŒ121βˆ’1 β‹… πŸπ‘—2

β€’ The separation acceleration at joint 2 will be the difference of the accelerations of the offset point on body 2 and the offset point on body 1

πšπ‘—2β€² = 𝐌222

βˆ’1 β‹… πŸπ‘—2 βˆ’ 𝐌112βˆ’1 β‹… πŸπ‘—1 +𝐌122

βˆ’1 β‹… βˆ’πŸπ‘—2

πšπ‘—2β€² = βˆ’πŒ112

βˆ’1 β‹… πŸπ‘—1 + 𝐌122βˆ’1 +𝐌222

βˆ’1 β‹… πŸπ‘—2 πŸπ‘˜1

πŸπ‘—1

πŸπ‘˜2

πŸπ‘—2

βˆ’πŸπ‘—2

π‘π‘œπ‘‘π‘¦ 1

π‘π‘œπ‘‘π‘¦ 2

π‘—π‘œπ‘–π‘›π‘‘ 2

π‘—π‘œπ‘–π‘›π‘‘ 1

Joint Forces

πšπ‘—1β€² = 𝐌111

βˆ’1 β‹… πŸπ‘—1 βˆ’πŒ121βˆ’1 β‹… πŸπ‘—2

πšπ‘—2β€² = βˆ’πŒ112

βˆ’1 β‹… πŸπ‘—1 + 𝐌122βˆ’1 +𝐌222

βˆ’1 β‹… πŸπ‘—2

πšπ‘—1β€²

πšπ‘—2β€² =

𝐌111βˆ’1 βˆ’πŒ121

βˆ’1

βˆ’πŒ112βˆ’1 𝐌122

βˆ’1 +𝐌222βˆ’1 β‹…

πŸπ‘—1πŸπ‘—2

πšπ‘—β€² = πŒβˆ’1 β‹… πŸπ‘—

Double Pendulum

πŒβˆ’1 =𝐌111

βˆ’1 βˆ’πŒ121βˆ’1

βˆ’πŒ112βˆ’1 𝐌122

βˆ’1 +𝐌222βˆ’1

πŸπ‘— = βˆ’πŒ β‹… πšπ‘— β€’ To compute the joint forces for the double pendulum:

– Apply known forces – Compute separation acceleration for each joint – Build 6x6 system inverse mass matrix

– Invert mass matrix to solve joint forces with πŸπ‘— = βˆ’πŒ β‹… πšπ‘— – Add joint forces to compute total forces and torques

Articulated Bodies

β€’ We can extend this method to large systems of constrained rigid bodies

β€’ We end up producing a large system mass matrix that relates the vector of all joint forces to the vector of all joint accelerations

β€’ If we assume 𝑛 3-DOF ball joints, we would end up with a 3𝑛 Γ— 3𝑛 mass matrix describing the relationship between joint forces and joint separation accelerations

Constraint Types

β€’ We’ve looked at 3-DOF ball-and-socket joints β€’ These are nice because they require solving a

straightforward 3D force β€’ However, other joint types are also possible such

as 1-DOF hinges, 2-DOF universal joints, 1-DOF translational β€˜prismatic’ joints, and more

β€’ These other joint types can apply a constraint force as well as torques

β€’ A 1-DOF hinge joint, for example, applied 5 constraints: 3 forces, and 2 torques, leaving 1 DOF free to rotate

Constraint Types

β€’ To handle different constraint types, we need to compute the individual mass matrices differently

β€’ We can generalize the force-acceleration relationship to include torques and angular accelerations

β€’ A 1-DOF rotational joint would require a 5x5 inverse mass matrix that relates 3 forces and 2 torques to 3 accelerations and 2 angular accelerations

β€’ The overall process is similar to how we derived the inverse mass matrix in the last lecture

System Mass Matrix

β€’ For a system of articulated rigid bodies, we end up with an π‘š Γ—π‘š mass matrix that relates constraint forces to accelerations, where π‘š is the total number of constrained degrees of freedom

β€’ We see that a large system of constraints results in a large matrix that must be inverted

β€’ The matrix will be more sparse for loosely coupled systems and less sparse for tightly coupled systems

β€’ The matrix will also be positive definite β€’ There are several approaches to solving this system:

– Direct matrix solution – Pairwise solution – Recursive solution (Featherstone’s algorithm) – Lagrangian formulation

Direct Solution

β€’ If we have a dense mass matrix, we can directly invert with standard matrix inversion or solvers

β€’ Larger matrices tend to be more sparse, and so can benefit from special purpose sparse solvers

β€’ There are a variety of special purpose solvers that can take advantage of properties of the system (sparseness, positive-definiteness…)

Pairwise Algorithms

β€’ One can also use pairwise algorithms to solve large systems of constraints

β€’ With this method, we group all constraints into a queue, ordered by the magnitude of the separation accelerations

β€’ We then iteratively solve for the constraint at the top of the queue, and then add it to the known forces, recomputing separation accelerations of connected joints and re-ordering the queue as needed

β€’ Basically, this method continues to fix the constraint with the largest separation and repeats until it converges and all separations approach zero

Featherstone’s Algorithm

β€’ Featherstone’s algorithm is a recursive method for solving the dynamics of tree structures without kinematic loops

β€’ It can evaluate systems in linear O(n) time β€’ It traverses from the fixed base (or an unfixed root) to the

leaf nodes computing joint separation accelerations and accumulating a mass matrix connecting from the base to each leaf

β€’ Then, it solves the joint forces from the leaves progressing back to the root

β€’ There are some adaptations to handle kinematic loops, but they compromise the linear time behavior

β€’ β€œRobot Dynamics Algorithms”, Featherstone, 1987

Lagrangian Dynamics

β€’ We can also reformulate the equations into the Lagrangian form β€’ This is fairly different from how we’ve done things so far β€’ Lagrangian methods define the state of the system using

generalized coordinates, only using coordinates for actual DOFs in the system

β€’ In this approach, the constraints never actually need to be solved, but we do have to solve for the motion of the degrees of freedom

β€’ If the number of unconstrained DOFs is less than the number of constrained DOFs, then these methods can be faster than the Newtonian methods described so far

β€’ However, the method can be tricky to work with and doesn’t handle collisions or energy damping easily

Kinematic Loops

β€’ We often distinguish between articulated bodies with open tree-like structures from bodies with closed kinematic loops

β€’ Closed loops can add challenges to some of the solution methods, as they may result in over-constrained systems and non-invertible mass matrices

β€’ Some methods require special handling for these, while other methods (like pairwise solvers) don’t require anything special

Collisions

Detection and Response

β€’ Collision handling requires two different technologies: – Collision detection (geometry) – Collision response (physics)

β€’ The collision detection problem is a complex application of 3D geometry and spatial data structures, and will be discussed in more detail in the next lecture

β€’ Collision response is the physics problem of determining the forces (or impulses) resulting from the collisions

Impact vs. Contact

β€’ It is useful to distinguish between momentary (instantaneous) impacts and finite time contacts

β€’ With impacts, the closing velocity is positive before the collision, and with contacts, the closing velocity is zero (or very close)

β€’ Some rigid body methods handle impacts differently from contacts, while other methods don’t distinguish between the two

Impulse

β€’ Force is the derivative of momentum, and changes in momentum require forces acting over time

β€’ An impulse 𝐣 is a large force applied over a short time, such that it can be treated as an instantaneous change in momentum, rather than a rate of change over time

𝐣 = πŸπ‘‘π‘‘

β€’ Impulses operate in a very similar fashion as forces, except they affect the velocity

instead of the acceleration β€’ As with forces, impulses obey Newton’s Third Law (action/reaction) β€’ An impulse can be applied to a rigid body at relative offset 𝐫 resulting in an

instantaneous change in momentum 𝐩 and angular momentum 𝐋 of the body

βˆ†π© = 𝐣 βˆ†π‹ = 𝐫 Γ— 𝐣

Collision Impulses

β€’ Most rigid body methods resolve instantaneous impacts with impulses

β€’ Persistent contacts can be simulated with forces or impulses, but many modern methods use impulses

β€’ In fact, constraints can be handled through forces or impulses as well, and by using impulses, one can handle impacts, contacts, and constraints through a single process

Single Body Impact

β€’ We define π±π‘Ÿ as the impact point, 𝐧 as the normal of the impact surface, π―π‘Ÿ as the offset velocity before the collision, π―π‘Ÿβ€² as the offset velocity after, and 𝐣 is the impulse

π―π‘Ÿ

π―π‘Ÿβ€² 𝐧

π±π‘Ÿ

𝐣

Collision Restitution

β€’ In terms of collisions, restitution refers to the amount of kinetic energy that is conserved, and thus the amount of bounce

β€’ We can measure it with a coefficient of restitution πœ€ that will range from 0 (perfectly inelastic) to 1 (perfectly elastic)

β€’ For simplicity, we can assume that we have a constant restitution for a rigid body. If two rigid bodies of different restitution collide, it is a reasonable heuristic to use the lower of the two for the impulse computation

β€’ Note: there are different ways to define the exact meaning of this constant, and it is ultimately just an approximation to a far more complex process that is dependent on the material properties and shape of the object

β€’ Note: sometimes called coefficient of elasticity

Collision Impulse

β€’ We need a collision impulse that will be applied at relative offset 𝐫 and must cancel out the velocity π―π‘Ÿ (at the same place)

β€’ We can construct an inverse mass matrix πŒβˆ’1 using 𝐫 for both offsets

πŒβˆ’1 =1 π‘š 0 00 1 π‘š 00 0 1 π‘š

βˆ’ 𝐫 β‹… πˆβˆ’1 β‹… 𝐫

β€’ We then invert it to get the mass matrix 𝐌 β€’ We can then solve for the impulse needed to cancel out the velocity

π―π‘Ÿ

π£π‘–π‘šπ‘π‘Žπ‘π‘‘ = βˆ’ 1 + πœ€ 𝐌 β‹… π―π‘Ÿ

*Frictionless Impact

β€’ [insert slide here]

Friction

Coulomb Friction

β€’ The simple but effective Coulomb friction model says:

π‘“π‘ π‘‘π‘Žπ‘‘ ≀ πœ‡π‘ π‘“π‘›π‘œπ‘Ÿπ‘š 𝑓𝑑𝑦𝑛 = πœ‡π‘‘π‘“π‘›π‘œπ‘Ÿπ‘š

β€’ Where π‘“π‘ π‘‘π‘Žπ‘‘ is the force due to static friction, 𝑓𝑑𝑦𝑛 is the force due to dynamic friction, π‘“π‘›π‘œπ‘Ÿπ‘š is the normal force, and πœ‡π‘  and πœ‡π‘‘ are the coefficients of static and dynamic friction

β€’ The direction of the force will be opposite of the tangential velocity at the contact point

β€’ The coefficients range from 0 (perfectly frictionless) to around 1.5 or so, but there really isn’t a strict maximum, as materials could conceivably have adhesive (sticky) properties

β€’ πœ‡π‘  is typically a bit larger than πœ‡π‘‘

Friction Cone

β€’ Consider a block sliding on a flat surface

β€’ The ground applies a normal force and a friction force

β€’ According to the Coulomb friction model, the two forces must add up to a vector that lies within the friction cone

β€’ The same can be said about impulses resulting from impacts

𝐣

πœ‡

1

Tangential Velocity

β€’ We need to find the tangential velocity of the impact in order to determine the direction the friction will act

β€’ We start by taking the difference of the two object velocities offset at the collision point

𝐯 = 𝐯1 βˆ’ 𝐯2 β€’ If 𝐧 is the surface normal if the contact point, we can decompose

the velocity into normal and tangential components:

π―π‘›π‘œπ‘Ÿπ‘š = 𝐯 β‹… 𝐧 𝐧 π―π‘‘π‘Žπ‘› = 𝐯 βˆ’ π―π‘›π‘œπ‘Ÿπ‘š

Rolling & Spinning Friction

β€’ One can also add rolling and spinning friction effects to collisions and contacts

β€’ We must first find the angular velocity difference at the collision point β€’ From there, we can decompose it into rolling and spinning components

based on the contact normal 𝐧

π›šπ‘ π‘π‘–π‘› = π›š β‹… 𝐧 𝐧

π›šπ‘Ÿπ‘œπ‘™π‘™ = π›šβˆ’π›šπ‘ π‘π‘–π‘› β€’ We can then apply friction torques proportional to each of those based on

separate constants

π›•π‘“π‘Ÿπ‘–π‘ = βˆ’ πŸπ‘›π‘œπ‘Ÿπ‘š πœ‡π‘ π‘π‘–π‘›π›šπ‘ π‘π‘–π‘› + πœ‡π‘Ÿπ‘œπ‘™π‘™π›šπ‘Ÿπ‘œπ‘™π‘™

Joint Friction

β€’ We can also add friction on articulated joints β€’ Usually, these would be based on the angular velocity of the joint, which is

the difference of the angular velocities of the two connected bodies β€’ For rotational joints, the joint friction will be in the form of a torque

applied equal and opposite to the two connected bodies

π›•π‘“π‘Ÿπ‘–π‘ = βˆ’πœ‡π‘—π‘œπ‘–π‘›π‘‘π›šπ‘—π‘œπ‘–π‘›π‘‘

β€’ Where π›•π‘“π‘Ÿπ‘–π‘ is the friction torque, πœ‡π‘—π‘œπ‘–π‘›π‘‘ is the joint friction, and π›šπ‘—π‘œπ‘–π‘›π‘‘ is the joint angular velocity

β€’ Static friction can also be modeled for joints. To do this, one must first assume a 6-DOF constraint and solve for the required constraint force. If this is within the static friction limit, it is used, otherwise, it is solved as a regular joint and dynamic friction is added

Collision Impulse with Friction

β€’ We wish to find a collision impulse 𝐣 that accounts for the elasticity and friction β€’ We can compute the velocity of the colliding point at offset 𝐫 as:

π―π‘Ÿ = 𝐯 + π›š Γ— 𝐫

π―π‘›π‘œπ‘Ÿπ‘š = π―π‘Ÿ β‹… 𝐧 𝐧 π―π‘‘π‘Žπ‘› = π―π‘Ÿ βˆ’ π―π‘›π‘œπ‘Ÿπ‘š

β€’ We also build the inverse mass matrix πŒβˆ’1 for the body using 𝐫 for both offsets β€’ We start by assuming perfect static friction and solving for the impulse that would result in an

elastic bounce and the tangential velocity going to zero after the collision:

π―π‘›π‘œπ‘Ÿπ‘šβ€² = βˆ’πœ€π―π‘›π‘œπ‘Ÿπ‘š

𝐣0 = 𝐌 β‹… π―π‘›π‘œπ‘Ÿπ‘šβ€² βˆ’ π―π‘›π‘œπ‘Ÿπ‘š

β€’ This allows us to solve the impulse that produces this result β€’ If this lies within the friction cone, then we’re done β€’ Otherwise, we assume sliding (dynamic) friction β€’ For more details, see section 7 of β€œNonconvex Rigid Bodies with Stacking”, Guendelman, Bridson,

Fedkiw, 2003

Multibody Collisions

Multiple Body Collisions

β€’ We can solve for multiple collisions in the same basic way that we solved for multiple constraint forces

β€’ We set up a large linear system that includes all of the collision constraints

β€’ There are two main differences from the articulated body solution: – For collisions, we work with impulses rather than

forces – For collisions, we are solving an inequality problem

rather than an equality problem

Linear Complementarity

β€’ Collisions result in inequality constraints because they will only act to prevent objects from moving towards each other and have no effect on objects moving apart

β€’ A large system of inequalities can be formed into a linear complementarity problem (LCP) which is a well studied class of problems

β€’ Various solution methods have been proposed to address these, and some are discussed in the overview paper on the web page

Pairwise Solvers

β€’ Pairwise solvers iteratively solve one collision at a time until the entire system is satisfied

β€’ These have proven to be pretty effective in handling of multiple collisions and constraints, as each one can be treated with its own rules and special cases

β€’ Some other methods may be faster, but pairwise solvers tend to be very general purpose and easy to implement