3 . 7. Other Game Physics Approaches

14
3.7. OTHER GAME PHYSICS APPROACHES Overview of other game engine physics approaches

description

3 . 7. Other Game Physics Approaches. Overview of other game engine physics approaches . Other Approaches. Overview of other game engine physics approaches . Simultaneous Contact Resolution. - PowerPoint PPT Presentation

Transcript of 3 . 7. Other Game Physics Approaches

Page 1: 3 . 7. Other Game Physics Approaches

3.7. OTHER GAME PHYSICS APPROACHESOverview of other game engine physics approaches

Page 2: 3 . 7. Other Game Physics Approaches

OTHER APPROACHESOverview of other game engine physics approaches

Page 3: 3 . 7. Other Game Physics Approaches

Simultaneous Contact ResolutionAs an alternative to resolving contacts one at a time, a group of contacts can be solved simultaneously.

Physics engines using this approach tend to employ force calculations rather than impulses, i.e. resting objects are kept apart by a constant force (and not a series of single-frame impulses).

A simultaneous resolution calculation tries to find the forces and impulses to apply at each contact, taking the interaction of all contacts into account.

The most common approach to doing this is by using a Jacobian and solving what is known as the “linear-complementary problem”.

Page 4: 3 . 7. Other Game Physics Approaches

The JacobianThe Jacobian is a mathematical construct (a matrix) that encodes how one contact affects another. It can be solved (usually) to provide a set of forces to be applied.

It operates by firstly combining the forces and torques for all objects into a single (long) vector (requiring 6xn entries, where n is the number of rigid bodies – 3 force components, 3 torque components).

Next, all accelerations (linear and angular) for all objects are also combined into another (long) vector.

The entries in the Jacobian matrix relate these two vectors, i.e. each location in the matrix encodes the amount of acceleration caused by the application of a unit of force or torque.

Page 5: 3 . 7. Other Game Physics Approaches

The JacobianSome of the entries in the matrix are very simple to calculated (using the equations of motion and rotation as used earlier).

The more complex entries arise when encoding the interaction of objects at contact points, but the same approach holds true – i.e. the effect per unit of applied force is calculated and encoded. Components within the Jacobian will also be used to model frictional forces. The flexibility of the Jacobian to represent interactions between objects, as well as the basic motion of the object itself, allows it to be used to create a much wider range of joints. For example, the motion of one object along one axis can be fixed; motors can be implemented by adding elements to the Jacobian that generate forces, etc.

Page 6: 3 . 7. Other Game Physics Approaches

Linear Complementary Problem

Resolving all the contacts, using a constructed Jacobian, J , requires that the following be resolved:

where f is a vector of force and torque components for all rigid bodies and is the resulting accelerations.

f comprises two components:

Where f known is the set of forces and torques we know we are applying (forces due to gravity or due to other force generators) and fcontacts is the set of forces that are generated in the contacts, which is what we’re trying to find out.

Relying on the distributive properties of matrices (i.e. A×(B +C) = A×B+A×C.), this can be written as:

In other words, the Jacobian is multiplied by the known force vector to get a known acceleration.

Page 7: 3 . 7. Other Game Physics Approaches

Linear Complementary Problem

Calculating is accomplished before contact resolution (i.e. this value does not change during the resolve process).

Stated as such, one approach (albeit computationally expensive and possibly without a solution) is to solve the equation by computing the inverse of the Jacobian. However, this does not take into account an additional constraint that:

where r is a vector of limits on how big the forces can be (frictional forces will have a defined limit)

The final calculation, finding f so that it fulfils both equations, is called the “linear complementary problem”.

Page 8: 3 . 7. Other Game Physics Approaches

Linear Complementary ProblemA commonly used algorithm for solving the LCP is called the “pivot algorithm.”

It works by making guesses for components in f and checking the results. The errors from one set of guesses can be used to modify components one at a time and converge at a solution. Under some assumptions that are commonly met in rigid body simulations, the guesses will always converge toward the solution. Complications can arise due to numerical instability and the approximation of fixed-length time steps. This can result in a situation where the pivot algorithm cannot be solved. A robust implementation must detect such situations and provide alternatives (although this adds to the overall complexity).

Page 9: 3 . 7. Other Game Physics Approaches

BREAKABLE / DEFORMABLE BODIESOverview of breakable and deformable bodies

Page 10: 3 . 7. Other Game Physics Approaches

Video not available in on-line slides

Page 11: 3 . 7. Other Game Physics Approaches

Video not available in on-line slides

Page 12: 3 . 7. Other Game Physics Approaches

DIRECTED READINGDirected reading concerning other physics approaches

Directed

reading

Page 13: 3 . 7. Other Game Physics Approaches

Directed reading Directed

reading

Page 14: 3 . 7. Other Game Physics Approaches

Summary

To do:Think if you want to

explore the more complex physics approaches.

Today we explored:

Summary of other physics approaches