Download presentation
Presentation is loading. Please wait.
Published byMilton Small Modified over 9 years ago
1
3.7. O THER G AME P HYSICS A PPROACHES Overview of other game engine physics approaches
3
As 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”.
4
The 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.
5
Some 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.
6
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 f contacts 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.
7
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”.
8
A 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).
9
Overview of breakable and deformable bodies
10
Video not available in on-line slides
12
Directed reading concerning other physics approaches Directed reading
13
Directed reading
14
To do: Think if you want to explore the more complex physics approaches. Today we explored: Summary of other physics approaches
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.