Physics Engines

28 flashcardsby Nijelous
Study these flashcardsFree · spaced repetition · iPhone, Android, Mac & web

All cards

1
Representing Object Movement
Requires Position, Velocity and Acceleration
2
Position
The location of an object in space, represented by a vector (2D or 3D)
3
Velocity
Amount of change in a position, represented in direction and magnitude (speed)
4
Acceleration
The amount of change in velocity
Not typically stored, calculated using other factors
5
Newton's First Law
Law of Inertia

An object keeps its velocity unless acted upon by some other force
6
Inertia
Resistance to change in motion
7
Newton's Second Law
Force = mass x acceleration
8
Newton's Third Law
For every action there is an equal and opposite reaction
9
Equations of Motion
SUVAT equations
s = Displacement
u = Initial Velocity
v = Final Velocity
a = Acceleration
t = Time

v = u + at
s = ut + 1/2at^2
s = 1/2(u+v)t
v^2 = u^2 + 2as
10
Vectors
Quantities that have both a magnitude and a direction.

E.g. [1, 0, 2]

Easily addable, easily multiplicative with a scalar

Normalised direction can be calculated by:
-vector / vector length
11
Derivatives
Calculation of change in something, makes for easy translation between velocity, acceleration, etc.
12
Integrals
The reversing of derivatives, used for figuring out the states of objects in the future.
13
Explicit Euler
vn+1 = vn + andt
pn+1 = pn + vndt

Uses the velocity and acceleration of the current frame to get the velocity of the next

Not perfect, we ignore acceleration throughout the timestep, causing inaccuracies over time
14
Implicit Euler
vn+1 = vn + an+1dt
pn+1 = pn + vn+1dt

Uses the projected velocity and acceleration of the next frame to get the velocity of the next

More accurate if you have the data, but since we don't due to real time simulation it is wildly inaccurate (prediction)
15
Semi-Implicit Euler
vn+1 = vn + andt
pn+1 = pn + vn+1dt

Uses the acceleration of the current frame and the projected velocity of the next frame.

Most accurate we can do in real time
16
Time in physics engines
Extremely important, as objects need to be consistent with each other
17
VSync
Stands for "vertical synchronization," is used to synchronize the graphics card/framerate with the output on the monitor.
18
Fixed Timestep
A customizable framerate-independent interval that dictates when physics calculations and FixedUpdate() events are performed, regardless of how fast the machine is running.
The smaller this is the better, as it gives more accurate results.
19
Physics Bodies
Objects recognised by a physics engine that it will update.
20
Particles
Easiest representation of a physics body

Has mass and position

Doesn't have orientation
21
Rigid Bodies
Most common representation of a physics body

Has mass, position, and volume the mess is distributed around, as well as orientation

Doesn't change shape over time
22
Springs
Elastic connectors that bring objects together and push them apart.

Uses Hooke's Law for the calculation (F = -kx) (K = elasticity of spring, X = distance from resting length)

Takes into account spring damping to get the effect of friction (F = -kx - c.v) (c = damping factor, v = velocity along spring axis)
23
Soft Bodies
Rigid bodies that can deform, used for cloth-type material.

Typically modelled with a grid of rigid bodies connected via springs with resting length equal to grid spacing.

If a force is applied to one of the masses, the springs attached to it stretch and eventually apply force to all the masses.

Does require extra structural support to maintain their 3D shapes
24
Physics Engine Loop
Integrate Acceleration
Collision Detection
Collision Resolution
Integrate Velocity
25
Integrating Acceleration
Forces that have acted on an object in a timestep are stored for calculation.

a = F/m
26
Mass
The amount of matter in an object

Stored in physics engines as 1/m, in order for a quicker calculation. Allows for infinitely heavy objects (m = 0)
27
Collision Detection & Resolution
Objects in the world are examined for collisions, and if so they react accordingly.
Done before velocity is calculated so the reactions can be taken into account.
Done after acceleration in order to determine momentum, so it can be conserved.
28
Integration of Velocity
Uses all previously calculated information to get the velocity of the object (using Semi-Implicit Euler or similar).

Typically game engines use a damping factor to reduce velocity over time (simulation of air resistance)
Study all 28 cards for free