44
Rigid Bodies

Rigid Bodies - Stanford University

  • Upload
    others

  • View
    11

  • Download
    3

Embed Size (px)

Citation preview

Page 1: Rigid Bodies - Stanford University

Rigid Bodies

Page 2: Rigid Bodies - Stanford University

Simulation Homework

โ€ข Build a particle system based either on F=ma or procedural simulation

โ€“ Examples: Smoke, Fire, Water, Wind, Leaves, Cloth, Magnets, Flocks, Fish, Insects, Crowds, etc.

โ€ข Simulate a Rigid Body

โ€“ Examples: Angry birds, Bodies tumbling, bouncing, moving around in a room and colliding, Explosions & Fracture, Drop the camera, Etcโ€ฆ

Thursday Simulation &

Unity

Page 3: Rigid Bodies - Stanford University

Rigid Body as โ€œParticle Chunksโ€

Consider a rigid body It can be broken up into chunks (or elements), and each chunk can be treated as a single particle if it is small enough

A small chunk of a rigid body

Page 4: Rigid Bodies - Stanford University

Center of Mass

โ€ข A body composed of ๐‘› particle โ€œchunksโ€ with masses ๐‘š๐‘– has total mass

๐‘€ =

๐‘–=1

๐‘›

๐‘š๐‘–

โ€ข If the particles have positions ิฆ๐‘ฅ๐‘– , the center of mass is

าง๐‘ฅ =ฯƒ๐‘–=1๐‘› ๐‘š๐‘– ิฆ๐‘ฅ๐‘–๐‘€

โ€ข The center of mass for a rigid body has position าง๐‘ฅ and translational velocity าง๐‘ฃ similar to a single particle

โ€ข When we refer to the position and velocity of a rigid body, we are referring to the position and translational velocity of its center of mass

โ€ข The center of mass obeys the same ODEs for position and velocity as a particle does, but using the TOTAL mass and the NET force

Page 5: Rigid Bodies - Stanford University

Orientation

Page 6: Rigid Bodies - Stanford University

Orientationโ€ข A rigid body can rotate or change its orientation

while its center of mass is stationary

โ€ข Different ways to keep track of the rotation ๐‘…:โ€“ 3x3 Matrix, 3 Euler angles, 1 Quaternion

โ€ข Place a coordinate system at the center of mass in object space

โ€ข The rotation ๐‘… rotates the rigid body (and the object space coordinate system) into its world space orientation

โ€ข Recall: the columns of ๐‘… are the three object space axes in their world space orientations

Page 7: Rigid Bodies - Stanford University

Combining Position and Orientation

าง๐‘ฅ

t

๐‘…

๐‘ฅ๐‘ค๐‘ฅ๐‘

โ€ข The rigid body has an intrinsic coordinate system in its object space, with its center of mass at the origin

โ€ข Itโ€™s put into world space with a translation and a rotation

Page 8: Rigid Bodies - Stanford University

Combining Position and Orientation

โ€ข The translation of the origin of the object space coordinate system is given by the position of the center of mass าง๐‘ฅ

โ€ข The world space orientation of the object space coordinate system is given by ๐‘…

โ€“ Assume ๐‘… is a matrix, equivalently expressed as a unit quaternion

โ€ข A point ๐‘ฅ๐‘œ in object space has a world space location๐‘ฅ๐‘ค = าง๐‘ฅ + ๐‘…๐‘ฅ๐‘œ

โ€“ Notice that the center of mass (at the origin) maps to าง๐‘ฅ

โ€“ Notice that (1,0,0), (0,1,0), (0,0,1) are all rotated by ๐‘… before being translated by าง๐‘ฅ

Page 9: Rigid Bodies - Stanford University

Angular Velocity

Page 10: Rigid Bodies - Stanford University

โ€ข Both าง๐‘ฅ and ๐‘… are functions of timeโ€ข The rate of change of the position of the center of mass าง๐‘ฅ

with respect to time is the translational velocity of the center of mass าง๐‘ฃ

โ€ข (From our quaternion discussionโ€ฆ) The orientation of the body is changing as it is rotated about some axis เทœ๐‘› emanating from the center of mass

โ€ข The rate of change of the orientation ๐‘… is given by the world space angular velocity ๐œ”โ€“ its direction is the axis of rotation, เทœ๐‘›โ€“ Its magnitude is the speed of rotation

โ€ข The pointwise velocity of any point x on the rigid body is given by

๐‘ฃ๐‘ = าง๐‘ฃ + ๐œ” ร— ๐‘ฅ โˆ’ าง๐‘ฅ = าง๐‘ฃ + ๐œ” ร— ๐‘Ÿwhere r is the moment arm and ร— is the cross-product

Angular Velocity

Page 11: Rigid Bodies - Stanford University

Aside: Cross Product Matrix

โ€ข Given vectors ๐‘Ž = [๐‘Ž1, ๐‘Ž2, ๐‘Ž3] and ๐‘ = ๐‘1, ๐‘2, ๐‘3 , their cross product ๐‘Ž ร— ๐‘ can be written as matrix multiplication ๐‘Žโˆ—๐‘ by converting ๐‘Ž to a cross product matrix

โ€ข ๐‘Žโˆ— =

0 โˆ’๐‘Ž3 ๐‘Ž2๐‘Ž3 0 โˆ’๐‘Ž1โˆ’๐‘Ž2 ๐‘Ž1 0

โ€ข ๐‘Žโˆ—๐‘‡ = โˆ’๐‘Žโˆ—

โ€ข ๐‘Žโˆ—๐‘ = โˆ’๐‘โˆ—๐‘Ž

โ€ข Using this new notation, the pointwise velocity of any point x on the object is then given by:

๐‘ฃ๐‘ = าง๐‘ฃ + ๐œ”โˆ—๐‘Ÿ

Page 12: Rigid Bodies - Stanford University

Linear and Angular Velocity

าง๐‘ฅ

าง๐‘ฃ

๐œ”

Page 13: Rigid Bodies - Stanford University

ODE for Orientation

โ€ข The ODE for orientation (angular position) is given by

แˆถ๐‘… = ๐œ”โˆ—๐‘…

โ€ข That is, แˆถ๐‘… = ๐œ” ร— ๐‘… where the cross product is applied independently to each of the three columns of ๐‘…

โ€ข Writing the 3x3 matrix ๐œ”โˆ— and using matrix multiplication ๐œ”โˆ—๐‘… automatically performs these 3 cross products

Page 14: Rigid Bodies - Stanford University

Inertia Tensor

Page 15: Rigid Bodies - Stanford University

Inertia Tensor

โ€ข Linear momentum is defined as the product of the mass times the translational velocityโ€“ Mass is something that resists change in velocity

โ€ข Angular momentum ๐ฟ is defined as an โ€œangular massโ€ times the angular velocity ๐œ”

โ€ข The โ€œangular massโ€ is called the moment of inertia (or inertia tensor) ๐ผ of the rigid body

โ€ข If you spin in your chair while extending your legs, and then suddenly pull your legs closer the chair spins fasterโ€“ ๐ผ reduces when you pull your legs closer.โ€“ Hence ๐œ” has to increase to keep angular momentum ๐ฟ = ๐ผ๐œ”

constant

Page 16: Rigid Bodies - Stanford University

Inertia Tensorโ€ข For a system of n particles, the angular momentum is

๐ฟ =

๐‘–

(๐‘ฅ๐‘–๐‘ค)โˆ—๐‘š๐‘–๐‘ฃ๐‘– =

๐‘–

าง๐‘ฅ + ๐‘Ÿ๐‘–โˆ—๐‘š๐‘–๐‘ฃ๐‘– = าง๐‘ฅโˆ—๐‘€ าง๐‘ฃ +

๐‘–

๐‘Ÿ๐‘–โˆ—๐‘š๐‘–๐‘ฃ๐‘–

โ€“ where ๐‘Ÿ๐‘– is the moment arm of the ๐‘–๐‘กโ„Žparticle

โ€ข ๐‘ฃ๐‘– can be written as าง๐‘ฃ + ๐œ”โˆ—๐‘Ÿ๐‘– so

๐ฟ = าง๐‘ฅโˆ—๐‘€ าง๐‘ฃ +

๐‘–

๐‘Ÿ๐‘–โˆ—๐‘š๐‘– าง๐‘ฃ +

๐‘–

๐‘Ÿ๐‘–โˆ—๐‘š๐‘–๐œ”

โˆ—๐‘Ÿ๐‘–

โ€ข ฯƒ๐‘– ๐‘Ÿ๐‘–โˆ—๐‘š๐‘– าง๐‘ฃ = ( าง๐‘ฃโˆ—)๐‘‡ ฯƒ๐‘–๐‘š๐‘–๐‘Ÿ๐‘– = 0 so

๐ฟ = าง๐‘ฅโˆ—๐‘€ าง๐‘ฃ +

๐‘–

๐‘š๐‘–(๐‘Ÿ๐‘–โˆ—)๐‘‡๐‘Ÿ๐‘–

โˆ—๐œ” = าง๐‘ฅโˆ—๐‘€ าง๐‘ฃ + ๐ผ๐œ”

โ€“ where ๐ผ = ฯƒ๐‘–๐‘š๐‘–(๐‘Ÿ๐‘–โˆ—)๐‘‡๐‘Ÿ๐‘–

โˆ—

Page 17: Rigid Bodies - Stanford University

Object Space Inertia Tensorโ€ข We can pre-compute the object space inertia tensor as a 3x3

matrix ๐ผ๐‘œ

โ€ข Then, the world space inertia tensor is given by the 3x3 matrix

๐ผ = ๐‘…๐ผ๐‘œ๐‘…๐‘‡

โ€ข One can compute the SVD of the symmetric 3x3 matrix ๐ผ๐‘œ to obtain ๐ผ๐‘œ = ๐‘ˆ๐ท๐‘ˆ๐‘‡ where ๐ท is a 3x3 diagonal matrix of 3 singular values

โ€ข Then rotating the object space rest state of the rigid body by ๐‘ˆโˆ’1 gives a new object space inertia tensor of

๐‘ˆโˆ’1๐ผ๐‘œ๐‘ˆโˆ’๐‘‡ = ๐‘ˆโˆ’1๐‘ˆ๐ท๐‘ˆ๐‘‡๐‘ˆโˆ’๐‘‡ = ๐ท

โ€ข That is, properly orienting the rest pose of a rigid body in object space gives a diagonal object space inertia tensor ๐ผ๐‘œ

Page 18: Rigid Bodies - Stanford University

Forces and Torques

Page 19: Rigid Bodies - Stanford University

Forces and Torquesโ€ข Newtonโ€™s second law for angular quantities

โ€ข A force ๐น changes both the linear momentum ๐‘€ าง๐‘ฃ and the rotational (angular) momentum ๐ฟ

โ€ข The change in linear momentum is independent of the point on the rigid body ๐‘ฅ where the force is applied

โ€ข The change in angular momentum does depend on the point ๐‘ฅ where the force is applied

โ€ข The torque is defined as๐œ = ๐‘ฅ โˆ’ าง๐‘ฅ ร— ๐น = ๐‘Ÿ ร— ๐น

โ€ข The net change in angular momentum is given by the sum of all the external torques

แˆถ๐ฟ = ๐œ

Page 20: Rigid Bodies - Stanford University

ODEs

Page 21: Rigid Bodies - Stanford University

Rigid Body: Equations of Motion

โ€ข State vector for a rigid body

๐‘‹ =

าง๐‘ฅ๐‘…๐‘€ าง๐‘ฃ๐ฟ

โ€ข Equations of motion

๐‘‘

๐‘‘๐‘ก๐‘‹ =

๐‘‘

๐‘‘๐‘ก

าง๐‘ฅ๐‘…๐‘€ าง๐‘ฃ๐ฟ

=

าง๐‘ฃ๐œ”โˆ—๐‘…๐น๐œ

Page 22: Rigid Bodies - Stanford University

Rigid Body: Equations of Motion

โ€ข State vector for a rigid body

๐‘‹ =

าง๐‘ฅ๐‘…าง๐‘ฃ๐ฟ

โ€ข Equations of motion

๐‘‘

๐‘‘๐‘ก๐‘‹ =

๐‘‘

๐‘‘๐‘ก

าง๐‘ฅ๐‘…าง๐‘ฃ๐ฟ

=

าง๐‘ฃ๐œ”โˆ—๐‘…๐น/๐‘€๐œ

Equations of motion for a particle at the center of mass

Page 23: Rigid Bodies - Stanford University

Forward Euler Update

๐‘‹๐‘›+1 = ๐‘‹๐‘› + ฮ”๐‘ก

าง๐‘ฃ๐œ”โˆ—๐‘…๐น/๐‘€๐œ

๐‘›

โ€ข Newmark for better accuracy and stability, etcโ€ฆ

โ€ข Better results are obtained on the second equation by rotating the columns of ๐‘… directly using the vector ฮ”๐‘ก๐œ”

โ€ข Need to periodically re-orthonormalize the columns of ๐‘… to keep it a rotation matrix

Page 24: Rigid Bodies - Stanford University

Rigid Body: Equations of Motion

โ€ข State vector for a rigid body

๐‘‹ =

าง๐‘ฅ๐‘žาง๐‘ฃ๐ฟ

โ€ข Equations of motion

๐‘‘

๐‘‘๐‘ก๐‘‹ =

๐‘‘

๐‘‘๐‘ก

าง๐‘ฅ๐‘žาง๐‘ฃ๐ฟ

=

าง๐‘ฃ1

2๐œ”โˆ—๐‘ž

๐น/๐‘€๐œ

โ€ข Once again, preferable to rotate q by ฮ”๐‘ก๐œ”โ€ข Renormalize q using a square root

Page 25: Rigid Bodies - Stanford University

Question #1

LONG FORM:โ€ข Summarize rigid body simulation.โ€ข Identify 10 rigid bodies in a typical room.

SHORT FORM:โ€ข Identify 10 rigid bodies in this room.

Page 26: Rigid Bodies - Stanford University

Geometry

Page 27: Rigid Bodies - Stanford University

Rigid Body Modelingโ€ข Store an object space triangulated surface to

represent the surface of the rigid body

โ€ข Store an object space implicit surface to represent the interior volume of the rigid body

โ€ข Collision detection between two rigid bodies can then be carried out by checking the surface of one body against the interior volume of another

โ€ข Implicit surfaces can be used to model the interior volume of kinematic and static objects as well

โ€ข Implicit surface representations of interior volumes can also be used for collisions with particles and particle systems

Page 28: Rigid Bodies - Stanford University

โ€ข Implicit surfaces represent a surface with a function ๐œ™(๐‘ฅ) defined over the whole 3D space

โ€ข The inside region ฮฉโˆ’, the outside region is ฮฉ+, and the surface ๐œ•ฮฉ are all defined by the function ๐œ™(๐‘ฅ)

โ€ข ๐œ™ ๐‘ฅ < 0 inside

โ€ข ๐œ™ ๐‘ฅ > 0 outside

โ€ข ๐œ™ ๐‘ฅ = 0 surface

โ€ข Easy to check if a point is inside an object

โ€ข Efficient to make topology changes to an object

โ€ข Efficient boolean operations: Union, Difference, Intersection

Recall: Implicit Surfaces

Page 29: Rigid Bodies - Stanford University

Analytic Implicit Surfaces

โ€ข For simple functions, write down the function and analytically evaluate ๐œ™(๐‘ฅ) to see if ๐œ™ ๐‘ฅ < 0 and thus ๐‘ฅ is inside the object

โ€ข 2D circle

โ€ข 3D ellipsoid

Page 30: Rigid Bodies - Stanford University

Discrete Implicit Surfaces

โ€ข Lay down a grid that spans the space you are trying to represent, e.g. a padded bounding box

โ€ข Store values of the function at grid points

โ€ข Then for arbitrary locations in space, interpolate from the nearby values on the grid to see if ๐œ™ ๐‘ฅ <0โ€ข use trilinear interpolation, like 3D textures

โ€ข Signed Distance Functions are implicit surfaces where the magnitude of the function gives the distance to the closet point on the surface

Page 31: Rigid Bodies - Stanford University

Constructing Signed Distance Functionsโ€ข Start with a triangulated surfaceโ€ข Place a grid inside a slightly padded bounding box of the object

โ€“ This grid will contain point samples for the signed distance functionโ€“ The resolution of the grid is based on heuristics

โ€ข Place a sphere at every grid point and find all intersecting triangles โ€“ the radius of the sphere only needs to be a few grid cells wide, because

we only care about grid points near the triangulated surfaceโ€“ If the sphere does not intersect any triangles, then the grid point is not

near the triangulated surfaceโ€“ (An acceleration structure is useful, e.g. bounding box hierarchy)

โ€ข For each nearby triangle, find the closest point on that triangle โ€“ see this document for details

โ€ข Take the minimum of all such distances as the magnitude of ๐œ™โ€ข Could initialize all grid points this way, but it is expensive for points

farther from the surface where one has to check many more (potentially all) triangles

Page 32: Rigid Bodies - Stanford University

Fast Marching Methodโ€ข Similar to Dijkstra's algorithm

โ€ข Walk outwards from the previously initialized points to fill the rest of the domain

Initialization

โ€ข Mark all the previously computed points nearby the triangulated surface as Black

โ€ข Mark the rest of the points White

Iteration

โ€ข White points adjacent to Black points are re-labeled as Red

โ€ข Estimate the distance value for all Red points using only their Black neighbors

โ€“ by solving a quadratic equation for distance

โ€ข The Red point with the smallest distance value is found and labeled Black

โ€“ a heap data structure is ideal, and then the fast marching method runs in ๐’ช ๐‘๐‘™๐‘œ๐‘”๐‘ where ๐‘ is the number of grid points

โ€ข Labeling this point Black turns some White points into Red

โ€“ and also changes the value of some of the previously computed Red points, since there is a new Black point to use in their distance computation

Page 33: Rigid Bodies - Stanford University

Sign of ๐œ™

โ€ข Perform a flood fill on the gridโ€“ Start from a random grid pointโ€“ Put it on a stack; mark it as 0โ€“ Pop it off; put its connected non-

occluded neighbors on the stack; mark them as 0; repeat

โ€“ When there are no more cells on the stack, find a random uncolored cell, mark it as 1, and repeat

โ€ข The region (0 or 1) that touches the grid boundary is marked as outside

โ€ข The other region is marked as inside

โ€ข Could have more than two regions in some cases

Page 34: Rigid Bodies - Stanford University

Question #2

LONG FORM:โ€ข Summarize rigid body geometric modeling.โ€ข Answer short form question below

SHORT FORM:โ€ข Give an example of a rigid body with an interesting

shape that could be used in a game. How would it be used?

Page 35: Rigid Bodies - Stanford University

Collisions

Page 36: Rigid Bodies - Stanford University

Collision Detectionโ€ข Test all the triangulated surface points of one body against the

implicit surface volume of the other (and vice versa)

โ€“ A world space point is put into object space to check against an implicit surface using

๐‘ฅ๐‘œ = ๐‘…โˆ’1(๐‘ฅ๐‘ค โˆ’ าง๐‘ฅ)

โ€ข Partial derivatives are used to compute the normal

๐‘› ๐‘ฅ0, ๐‘ฆ0, ๐‘ง0 = เธญ๐‘‘๐œ™

๐‘‘๐‘ฅ,๐‘‘๐œ™

๐‘‘๐‘ฆ,๐‘‘๐œ™

๐‘‘๐‘ง๐‘ฅ0,๐‘ฆ0,๐‘ง0

๐‘๐‘œ๐‘Ÿ๐‘š๐‘Ž๐‘™ ๐‘ฅ0, ๐‘ฆ0, ๐‘ง0 =๐‘› ๐‘ฅ0, ๐‘ฆ0, ๐‘ง0๐‘› ๐‘ฅ0, ๐‘ฆ0, ๐‘ง0

โ€ข Note: A particle can be moved to the surface of the implicit surface by tracing a ray in the normal direction and looking for the intersection with the ๐œ™ = 0 isocontour (see CS148)

Page 37: Rigid Bodies - Stanford University

Rigid Body Collisions

Collision detection

๐‘ข1

๐‘ข2

Compute the initial relative velocity

The final relative velocity is calculated using the coefficient of restitution.

Calculate and apply the collision impulse

๐‘—2

๐‘—1

After evolving the bodies in time, they eventually separate

Page 38: Rigid Bodies - Stanford University

Collision Response

Equations for applying an impulse to one body with collision location ๐‘Ÿ๐‘ with respect to its center of mass:

โ€ข ๐‘€ าง๐‘ฃ๐‘›๐‘’๐‘ค = ๐‘€ าง๐‘ฃ + ๐‘—

โ€ข ๐ผ๐œ”๐‘›๐‘’๐‘ค = ๐ผ๐œ” + ๐‘Ÿ๐‘โˆ—๐‘— (note ๐ผ doesnโ€™t change)

โ€ข And then, in terms of the pointwise velocityโ€ฆ

โ€ข ๐‘ข๐‘๐‘›๐‘’๐‘ค = าง๐‘ฃ๐‘›๐‘’๐‘ค + ๐œ”๐‘›๐‘’๐‘คโˆ—

๐‘Ÿ๐‘ = าง๐‘ฃ๐‘›๐‘’๐‘ค + ๐‘Ÿ๐‘โˆ—๐‘‡๐œ”๐‘›๐‘’๐‘ค

โ€ข ๐‘ข๐‘๐‘›๐‘’๐‘ค = าง๐‘ฃ +

๐‘—

๐‘€+ ๐‘Ÿ๐‘

โˆ—๐‘‡ ๐œ” + ๐ผโˆ’1๐‘Ÿ๐‘โˆ—๐‘—

โ€ข ๐‘ข๐‘๐‘›๐‘’๐‘ค = ๐‘ข๐‘ +

1

๐‘€๐ผ3๐‘ฅ3 + ๐‘Ÿ๐‘

โˆ—๐‘‡๐ผโˆ’1๐‘Ÿ๐‘โˆ— ๐‘— = ๐‘ข๐‘ + ๐พ๐‘—

โ€ข Infinite mass kinematic/static objects (e.g. ground plane) are treated by setting the impulse factor ๐พ = 0

Page 39: Rigid Bodies - Stanford University

Collision Responseโ€ข Equal and opposite impulse applied to each body:

๐‘ข1๐‘›๐‘’๐‘ค = ๐‘ข1 + ๐พ1๐‘— and ๐‘ข2

๐‘›๐‘’๐‘ค = ๐‘ข2 โˆ’ ๐พ2๐‘—

โ€ข Calculate the relative velocity ๐‘ข๐‘Ÿ๐‘’๐‘™ = ๐‘ข1 โˆ’ ๐‘ข2 at the point of collisionโ€“ Relative normal velocity is ๐‘ข๐‘Ÿ๐‘’๐‘™,๐‘ = ๐‘ข๐‘Ÿ๐‘’๐‘™ โ‹… ๐‘

โ€“ Only collide when ๐‘ข๐‘Ÿ๐‘’๐‘™,๐‘ < 0, i.e. bodies not already separating

โ€ข Define a total impulse factor ๐พ๐‘‡ = ๐พ1 + ๐พ2, then

๐‘ข๐‘Ÿ๐‘’๐‘™๐‘›๐‘’๐‘ค = ๐‘ข๐‘Ÿ๐‘’๐‘™ + ๐พ๐‘‡๐‘—

๐‘ข๐‘Ÿ๐‘’๐‘™,๐‘๐‘›๐‘’๐‘ค = ๐‘ข๐‘Ÿ๐‘’๐‘™,๐‘ +๐‘๐‘‡๐พ๐‘‡๐‘—

โ€ข Since the collision impulse should be in the normal direction, we can write ๐‘— = ๐‘๐‘—๐‘›, hence

๐‘ข๐‘Ÿ๐‘’๐‘™,๐‘๐‘›๐‘’๐‘ค = ๐‘ข๐‘Ÿ๐‘’๐‘™,๐‘ + ๐‘๐‘‡๐พ๐‘‡๐‘๐‘—๐‘›

โ€ข Given ๐‘ข๐‘Ÿ๐‘’๐‘™,๐‘๐‘›๐‘’๐‘ค = โˆ’๐‘๐‘…๐‘ข๐‘Ÿ๐‘’๐‘™,๐‘, we solve for ๐‘—๐‘› and apply ๐‘— = ๐‘๐‘—๐‘›

Page 40: Rigid Bodies - Stanford University

Frictionโ€ข Relative tangential velocity is ๐‘ข๐‘Ÿ๐‘’๐‘™,๐‘‡ = ๐‘ข๐‘Ÿ๐‘’๐‘™ โˆ’ ๐‘ข๐‘Ÿ๐‘’๐‘™,๐‘๐‘

โ€ข First assume static friction, i.e. ๐‘ข๐‘Ÿ๐‘’๐‘™,๐‘‡๐‘›๐‘’๐‘ค = 0, so that

๐‘ข๐‘Ÿ๐‘’๐‘™๐‘›๐‘’๐‘ค = โˆ’๐‘๐‘…๐‘ข๐‘Ÿ๐‘’๐‘™,๐‘๐‘

โ€ข Solve for a full 3D impulse ๐‘— using ๐‘ข๐‘Ÿ๐‘’๐‘™๐‘›๐‘’๐‘ค = ๐‘ข๐‘Ÿ๐‘’๐‘™ + ๐พ๐‘‡๐‘—, by inverting

the 3x3 matrix ๐พ๐‘‡โ€ข If this impulse is in the friction cone, i.e. if ๐‘— โˆ’ ๐‘— โ‹… ๐‘ ๐‘ โ‰ค ๐œ‡๐‘  ๐‘— โ‹… ๐‘ ,

then the assumption of sticking due to static friction was correct

โ€ข Otherwise we start over using kinetic friction instead (๐œ‡๐‘˜โ‰ค ๐œ‡๐‘ )

โ€“ With tangential direction ๐‘‡ =๐‘ข๐‘Ÿ๐‘’๐‘™,๐‘‡

๐‘ข๐‘Ÿ๐‘’๐‘™,๐‘‡, the kinetic friction impulse

is ๐‘— = ๐‘—๐‘›๐‘ โˆ’ ๐œ‡๐‘˜๐‘—๐‘›๐‘‡

โ€“ And we can solve โˆ’๐‘๐‘…๐‘ข๐‘Ÿ๐‘’๐‘™,๐‘= ๐‘ข๐‘Ÿ๐‘’๐‘™,๐‘ +๐‘๐‘‡๐พ๐‘‡ ๐‘ โˆ’ ๐œ‡๐‘˜๐‘‡ ๐‘—๐‘› to find ๐‘—๐‘› before applying ๐‘— = ๐‘ โˆ’ ๐œ‡๐‘˜๐‘‡ ๐‘—๐‘›

Page 41: Rigid Bodies - Stanford University

Question #3

LONG FORM:โ€ข Summarize rigid body collision handling.โ€ข Answer short form question below.

SHORT FORM:โ€ข Give an example of using collisions between rigid

bodies for a game.

Page 42: Rigid Bodies - Stanford University

Fracture

Page 43: Rigid Bodies - Stanford University

Fracture

Page 44: Rigid Bodies - Stanford University

Fractureโ€ข Suppose a rigid body fractures into n pieces with

masses ๐‘š1, , ๐‘š2 โ€ฆ๐‘š๐‘›, velocities ๐‘ฃ1, ๐‘ฃ2โ€ฆ . ๐‘ฃ๐‘›, inertia tensors ๐ผ1, ๐ผ2, โ€ฆ ๐ผ๐‘› and angular velocities ๐œ”1, ๐œ”2, โ€ฆ๐œ”๐‘›

โ€ข The mass and inertia tensor of each new piece can be computed based on the geometry

โ€ข What can we say about the fractured pieces?โ€“ M๐‘ฃ = ฯƒ๐‘š๐‘–๐‘ฃ๐‘–โ€“ ๐ผ๐œ” = ฯƒ(๐‘Ÿ๐‘–

โˆ—๐‘š๐‘–๐‘ฃ๐‘– + ๐ผ๐‘–๐œ”๐‘–)

โ€ข To ensure this:โ€“ Assign each rigid body the velocity its newly created center

of mass had before fracturing i.e. ๐‘ฃ๐‘– = ๐‘ฃ + ๐œ” ร— ๐‘Ÿ๐‘–โ€ข where ๐‘Ÿ๐‘– points from the center of mass of the original rigid body to

the center of mass of the i-th child

โ€“ Angular momentum is then conserved by setting ๐œ”๐‘– = ๐œ”