simple verlet physics by stuart allen (funkypear)
DESCRIPTION
Stuart Allen instructs how to utilize verlet physics for more elegant motion in games.TRANSCRIPT
![Page 1: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/1.jpg)
Simple Verlet Physics for Games
Stuart Allen(aka FunkyPear)
![Page 2: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/2.jpg)
Euler Integration
Simplest method of moving particles and objects Need to keep track of object position and speed Each frame/time step add speed to position:
X = X + speedX
Y = Y + speedY
![Page 3: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/3.jpg)
Euler Integration
![Page 4: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/4.jpg)
Verlet Integration
Also fairly simple, but expandable to be more accurate (outside scope of this talk)
Need to keep track of object current position and previous position
Each frame/time step, calculate distance travelled since last time, and add to current position:
X = X + (X - oldX)
Y = Y + (Y - oldY)
![Page 5: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/5.jpg)
Verlet Integration
![Page 6: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/6.jpg)
Demo 1
Euler & Verlet Particle Movement Demo
![Page 7: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/7.jpg)
Constraints
Constraints ensure two particles stay a certain distance apart by moving them towards or away from each other
![Page 8: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/8.jpg)
Demo 2
Particle Constraint Demo
![Page 9: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/9.jpg)
Gravity & Other Forces
Forces applied directly to particle positions Gravity: y += 1
Verlet motion makes force persist (inertia)
![Page 10: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/10.jpg)
Demo 3
Particle Constraint with Gravity Demo
![Page 11: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/11.jpg)
Simple Four Step Verlet Engine
Step 1: Apply forces (gravity, wind, etc)
Step 2: Verlet update
Step 3: Constraints
Step 4: Collision Detection
![Page 12: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/12.jpg)
Rope
Expanding from our last demo, rope can be simulated by having a chain of points connected in row with sticks
![Page 13: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/13.jpg)
Demo 4
Multiple Constraints Rope Demo
![Page 14: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/14.jpg)
Cloth
Cloth can be simulated by a grid of points that are connected to their neighbours
![Page 15: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/15.jpg)
Demo 5
Rope Becomes Cloth Demo
![Page 16: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/16.jpg)
Relaxation
Loop over constrain step multiple time to pull points together and make final result more rigid
Less constrain loops means a more bendy and bouncy structure
![Page 17: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/17.jpg)
Engine Upgrade: Fixed Points
Fixed points do not move – other end of stick does all the moving
![Page 18: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/18.jpg)
Structures & Towers
Adding fixed points allows us to build fixed but flexible structures
Towers (fixed points on ground) Bridges (fixed points on either edge of a gap) Dangling ropes (fixed point above rope)
![Page 19: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/19.jpg)
Structures & Towers
![Page 20: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/20.jpg)
Demo 6
Towers Editor Demo
![Page 21: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/21.jpg)
Demo 7
Game Jam Tower Game Demo
![Page 22: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/22.jpg)
Similar Mechanic:World of Goo (2D Boy)
![Page 23: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/23.jpg)
Engine Upgrade: Stick Length Tolerance
Sticks previously had set length Modify sticks to have min and max lengths. Soft body dynamics possible due to addition valid
solutions
![Page 24: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/24.jpg)
Blobs
Blobs attempt to mimic gooey / gelatinous objects
Multiple different configurations: Centre point makes blob seem more solid Double skinning helps stop edge points glitching More tolerance in inner sticks makes for a flatter,
more dynamic blob
![Page 25: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/25.jpg)
Demo 8
Blobs Editor Demo
![Page 26: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/26.jpg)
Blobs – Each Point Linked to Opposite
![Page 27: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/27.jpg)
Blobs – With Central Point
![Page 28: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/28.jpg)
Similar Mechanic:Gish (Chronic Logic)
![Page 29: Simple Verlet Physics by Stuart Allen (FunkyPear)](https://reader034.vdocuments.us/reader034/viewer/2022042613/54b481634a795908158b462a/html5/thumbnails/29.jpg)
Thanks for listening! :)
More info and source code at
www.funkypear.com/mochilondon2012