Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Game Design and Development

Similar presentations


Presentation on theme: "Computer Game Design and Development"— Presentation transcript:

1 Computer Game Design and Development
Mathematics, Collision, and Physics Havok Destruction

2 Basic Problem Without physics: We must determine: There’s no gravity
There’s no friction There are no collisions Objects pass through one another We must determine: If objects collide (collision detection) Where/when they collided (collision resolution)

3 Collision Detection Bullets (very fast) Characters (very complex)
Naïve algorithms run in O(n2) Two primary methods: Overlap testing (most common) Intersection testing (sweeping)

4 Overlap Testing Determines if two objects overlap (duh!)
Check each vertex of an object inside another? Exhibits the most error Is discrete (i.e. checks an exact point in time) Results: Give a time of collision Give a normal of collision Uses bisection…

5 Overlap Bisection

6 Limitations of Overlap Testing
Design constraint? Speed of objects * time step < size of all objects? Reduce time step?

7 Intersection Testing “Sweep” an object from one point to another (i.e. “extrude” – sphere becomes capsule). Can calculate t with an equation-> See book for equation Doesn’t work well for network games

8 Collision Approximations Minkowski Sum – sweep origin of X across Y
Intersection technique. These are the same!

9 Bounding Volumes and Boxes
AABB OBB

10 About Bounding Volumes
Simplest is sphere Next is capsule (2 spheres and a cylinder), Next are AABBs What can we do about character collisions?

11 Performance (avoiding O(n2))
Possible collision between R and B since overlap in all axis (2 in this case) Subdivide such that on average one object in each cell. Test against neighboring cells What if all are in one cell? Variable-sized objects? “Plane sweep” needs to be sorted! Which algorithm? Quicksort? Bubblesort?

12 Terrain Collision Determine which quad is easy
Heightmap (x and z are fixed, y is variable) Which triangle in the quad? Compare x with z

13 Resolving Collision Gross collision & subdivide if needed Three phases
Prologue – ignore or trigger other events Collision – objects moved to point of impact, new velocities, calculate normal and penetration Epilogue – destroy object, effects, damage, etc

14 Particle Physics Basics
Use consistent units (SI) – or bad stuff happens Particle kinematics Position (p) in 3-space, vector3 (x,y,z) = p(t) Velocity (v) = change in position over time, V(t) Acceleration (a) = change in velocity over time, a(t) Force (f) = results in change in acceleration over time, F(t) = ma(t) Calculus Derivatives and integrals go from one to another

15 Center of Mass

16 Collision Response (frictionless)

17 Other Definitions Kinematic objects: those that move
Static objects: those that don’t, but affect those that do (terrain) Rigid bodies: objects that do not deform Soft bodies: those that do Center of gravity changes Cloth, deflated ball…

18 Rigid Body Collision Center of Mass Consideration

19 More Definitions Constraints: Ragdoll physics:
Limitations on what objects can do Joint types: ball joint, hinge joint, sliding joint Ragdoll physics: Animated bones replaced by rigid bodies Good for violent death animations

20 Physics Engines Commercial Free/Shareware Game Dynamics SDK (Havok)
Renderware Physics PhysX (NVIDIA) NovodeX SDK Free/Shareware Open Dynamics Engine (ODE) Tokamak Game Physics SDK Newton Game Dynamics SDK Bullet SDK

21 Demos


Download ppt "Computer Game Design and Development"

Similar presentations


Ads by Google