Computer Game Design and Development

Slides:



Advertisements
Similar presentations
Everything you ever wanted to know about collision detection
Advertisements

Real-Time Game Physics
Chapter 4.2 Collision Detection and Resolution. 2 Collision Detection Complicated for two reasons 1. Geometry is typically very complex, potentially requiring.
Collision Detection CSCE /60 What is Collision Detection?  Given two geometric objects, determine if they overlap.  Typically, at least one of.
Collision Detection and Resolution Zhi Yuan Course: Introduction to Game Development 11/28/
Geometry Primer Lines and rays Planes Spheres Frustums Triangles Polygon Polyhedron.
Chapter 13 – Vector Functions
Computational Geometry & Collision detection
CS4455 Physics Engines Maribeth Gandy Jeff Wilson Clint Doriot
Week 14 - Monday.  What did we talk about last time?  Bounding volume/bounding volume intersections.
Chapter 4.2 Collision Detection and Resolution. 2 Collision Detection Complicated for two reasons 1. Geometry is typically very complex, potentially requiring.
1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern.
1 Geometry A line in 3D space is represented by  S is a point on the line, and V is the direction along which the line runs  Any point P on the line.
UNC Chapel Hill S. Redon - M. C. Lin Rigid body dynamics II Solving the dynamics problems.
Game Mathematics & Game State The Complexity of Games Expectations of Players Efficiency Game Mathematics o Collision Detection & Response o Object Overlap.
CSCE 590E Spring 2007 Collision Detection By Jijun Tang.
Haptic Cloth Rendering 6th Dutch-Belgian Haptics Meeting TUDelft, 21 st June 2006 Lode Vanacken Expertise centre for Digital Media (EDM) Hasselt University.
Mechanics, Dynamics & Aesthetics The Complexity of Games Expectations of Players Efficiency Game Mathematics o Collision Detection & Response o Object.
1cs533d-term Notes  Typo in test.rib --- fixed on the web now (PointsPolygon --> PointsPolygons)
Collision Detection Michael Fuller. Overlap testing Most Common Technique Most Error Prone Test if two bodies overlap.
Physics Simple – Pong Medium – Rigid bodies F = ma Circles, spheres, rectangles for collisions Complex – Fluids, clothings, explosions, hair.
Collision Detection David Johnson Cs6360 – Virtual Reality.
CIS 487/587 Bruce R. Maxim UM-Dearborn
Computer graphics & visualization Collision Detection – Narrow Phase.
CS 4730 Collision Detection CS 4730 – Computer Game Design.
CS 4730 Physical Simulation CS 4730 – Computer Game Design.
Lecture VII Rigid Body Dynamics CS274: Computer Animation and Simulation.
CSE 380 – Computer Game Programming Box2D Box2D TestBed.
CSE 381 – Advanced Game Programming Quickhull and GJK.
CSCE 552 Spring 2009 Math, Physics and Collision Detection By Jijun Tang.
3D Graphics for Game Programming Chapter XII Physics-based Simulation.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Collisions & Contact.
CO1301: Games Concepts Dr Nick Mitchell (Room CM 226) Material originally prepared by Gareth Bellaby.
12/4/2001CS 638, Fall 2001 Today Managing large numbers of objects Some special cases.
Computer Game Design and Development Mathematics, Collision, and Physics Havok Destruction.
NVIDIA PhysX: 物理引擎 (Physics Engine) V-lab Talk 2010/12/03 洪偉瀚.
Simplified Smoothed Particle Hydrodynamics for Interactive Applications Zakiya Tamimi Richard McDaniel Based on work done at Siemens Corporate.
Advanced Computer Graphics Rigid Body Simulation Spring 2002 Professor Brogan.
CSCE 552 Fall 2012 Math, Physics and Collision Detection By Jijun Tang.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Physics for Games Spring 2012.
Unity3D Physics April 3, 2015 Comp Game Design Michael Shah.
Collision Detection And Response Jae Chun KyungSoo Im Chau Vo Hoang Vu.
CSE 380 – Advanced Game Programming Sweep & Prune.
2.1 Position, Velocity, and Speed 2.1 Displacement  x  x f - x i 2.2 Average velocity 2.3 Average speed  
CS274 Spring 01 Lecture 7 Copyright © Mark Meyer Lecture VII Rigid Body Dynamics CS274: Computer Animation and Simulation.
Unit 2 Momentum and Impulse An Introduction to Momentum.
Computer Game Design and Development Collision Detection Havok Destruction.
Advanced Games Development Game Physics CO2301 Games Development 1 Week 19.
Rick Parent - CIS682 Rigid Body Dynamics simulate basic physics of an object subject to forces Keyframing can be tedious - especially to get ‘realism’
1 Computer Game Physics The very basics. 2 The Basics Force F Mass m Acceleration a: a = F/m Velocity v: v = a*t Position s: s = v*t …if F is constant.
Game Programming 13 Physics in Games (cont.) 2010 년 2 학기 디지털콘텐츠전공.
Introduction to Game Programming & Design III Lecture III.
Computer Graphics Imaging Ying Zhu Georgia State University Lecture 29 Soft Bodies and Rigid Bodies.
CSCE 552 Fall 2012 Math, Physics and Collision Detection By Jijun Tang.
Fundamentals of Computer Animation Collision Detection and Response.
Advanced Computer Graphics Rigid Body Simulation
CS-378: Game Technology Lecture #15: Physically Based Simulation
EECE 478 Game Physics.
Parts of these slides are based on
Physics in Games David: Overview of Physics in Games
Math, Physics and Collision Detection
Chapter 4.2 Collision Detection and Resolution
Physics in Games David: Achieving Fun with Physics
Collision detection and rigid body dynamics
Motion in Real and Virtual Worlds
Computer Animation Algorithms and Techniques
Advanced Games Development Game Physics
CO Games Concepts Week 12 Collision Detection
GPAT – Chapter 7 Physics.
Presentation transcript:

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

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)

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)

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…

Overlap Bisection

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

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

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

Bounding Volumes and Boxes AABB OBB

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

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?

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 http://creators.xna.com/en-US/sample/collision3dheightmap

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

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

Center of Mass

Collision Response (frictionless)

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…

Rigid Body Collision Center of Mass Consideration

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 http://www.youtube.com/watch?v=4gR_dP4HaF8

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

Demos http://www.havok.com/content/view/584/96/ http://www.tokamakphysics.com/index.htm