Advanced Games Development Game Physics

Slides:



Advertisements
Similar presentations
Real-Time Game Physics
Advertisements

Rotational Motion Chapter Opener. Caption: You too can experience rapid rotation—if your stomach can take the high angular velocity and centripetal acceleration.
Manipulator Dynamics Amirkabir University of Technology Computer Engineering & Information Technology Department.
CS4455 Physics Engines Maribeth Gandy Jeff Wilson Clint Doriot
Rolling, Torque, and Angular Momentum Rolling: Translation and Rotation Friction and Rolling Yo-yo Torque: A Cross Product Angular Momentum Newton’s Second.
Dynamics of a Rigid Body
Physics 121 Newtonian Mechanics Lecture notes are posted on Instructor Karine Chesnel April 2, 2009.
Design Realization lecture 8 John Canny 9/18/03. Preamble  Handouts include the Maya bible chapters on skeletons and IK.  First assignment models are.
1 7M836 Animation & Rendering Animation Jakob Beetz Joran Jessurun
Game Physics Chris Miles. The Goal To learn how to create game objects with realistic physics models To learn how to simulate aspects of reality in order.
Department of Physics and Applied Physics , F2010, Lecture 19 Physics I LECTURE 19 11/17/10.
Manipulator Dynamics Amirkabir University of Technology Computer Engineering & Information Technology Department.
Semester Physics 1901 (Advanced) A/Prof Geraint F. Lewis Rm 560, A29
Computer graphics & visualization Rigid Body Simulation.
3.7. O THER G AME P HYSICS A PPROACHES Overview of other game engine physics approaches.
Velocities and Static Force
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Physically Based Animation.
Mechanics and Materials Forces Displacement Deformation (Strain) Translations and Rotations Stresses Material Properties.
Spring Topic Outline for Physics 1 Spring 2011.
Lecture VII Rigid Body Dynamics CS274: Computer Animation and Simulation.
DYNAMICS Part I Physics Engine By Willis (The Magnificent) Louie Fei (The Coyote) Liao.
Chapters 10, 11 Rotation and angular momentum. Rotation of a rigid body We consider rotational motion of a rigid body about a fixed axis Rigid body rotates.
Physically Based Modeling Let physics take over!.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Collisions & Contact.
Rigid Body Particle Object without extent Point in space Solid body with small dimensions.
Chipmunk Physics Remember that we talked about this a bit when we did collision handlers for the space ship integration task (SpritesActionsPhysicsSound).
Computer Game Design and Development
Games Development 1 Review / Revision CO2301 Games Development 1 Semester 2.
Lecture 6: Time Response 1.Time response determination Review of differential equation approach Introduce transfer function approach 2.MATLAB commands.
Robotics II Copyright Martin P. Aalund, Ph.D.
1 Rotation of a Rigid Body Readings: Chapter How can we characterize the acceleration during rotation? - translational acceleration and - angular.
Angular Momentum Section 8.1 (Ewen et al. 2005) Objectives: Define and calculate moment of inertia. Define and calculate moment of inertia. Define and.
CS274 Spring 01 Lecture 7 Copyright © Mark Meyer Lecture VII Rigid Body Dynamics CS274: Computer Animation and Simulation.
Unit: NM 8 Topic(s): Rotational Inertia and Torque
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’
Graphics for Games Particle Systems CO2301 Games Development 1 Week 23.
Physics Michael Vernier Robert Weekley Michael Ford.
Physics 111 Lecture Summaries (Serway 8 th Edition): Lecture 1Chapter 1&3Measurement & Vectors Lecture 2 Chapter 2Motion in 1 Dimension (Kinematics) Lecture.
Computer Graphics Imaging Ying Zhu Georgia State University Lecture 29 Soft Bodies and Rigid Bodies.
Advanced Games Development Physics Engines 2 CO2301 Games Development 1 Week 21.
Feature-length films: Games: Desktop Animations:.
Chapter 8 Rotational Motion and Equilibrium. Units of Chapter 8 Rigid Bodies, Translations, and Rotations Torque, Equilibrium, and Stability Rotational.
Chapter 8 Lecture Pearson Physics Rotational Motion and Equilibrium Prepared by Chris Chiaverina © 2014 Pearson Education, Inc.
Physically Based Simulations For Games
2D Simulation of Rigid Bodies
What is statics? Lecture 1
Manipulator Dynamics 1 Instructor: Jacob Rosen
ROTATIONAL MOTION Rotation axis: rotation occurs about an axis that does not move: fixed axis.
Computer Animation Ying Zhu Georgia State University
Lecture 16 Newton Mechanics Inertial properties,Generalized Coordinates Ruzena Bajcsy EE
College Physics, 7th Edition
General Physics I Rotational Motion
College Physics, 7th Edition
PHYS 1441 – Section 002 Lecture #22
3.7. Other Game Physics Approaches
Rotational Motion AP Physics.
Make-up Labs Arrange with Victor in BSB-117 Physics 1D03 - Lecture 31.
Manipulator Dynamics 2 Instructor: Jacob Rosen
Spring 2002 Lecture #15 Dr. Jaehoon Yu Mid-term Results
Using the “Clicker” If you have a clicker now, and did not do this last time, please enter your ID in your clicker. First, turn on your clicker by sliding.
Motion in Real and Virtual Worlds
Statics Dr. Aeid A. Abdulrazeg Course Code: CIVL211
Computer Animation Algorithms and Techniques
Dynamics of Rotational Motion
Computer Graphics Lecture 15.
Games Development 1 Review / Revision
GPAT – Chapter 7 Physics.
Subjects: 1- Introduction, Basic Definitions and concepts. Fast Review on Engineering 2- Velocity Analysis in Mechanisms 3- Acceleration Analysis in Mechanisms.
Presentation transcript:

Advanced Games Development Game Physics CO2301 Games Development 1 Week 21

Today’s Lecture Introduction Collision Bodies Physical Properties Relationship with Scene Models Practical Issues

Introduction Physics engines simulate Newtonian physics for models in a scene Usually a separate library Real-time simulation of movement and interaction The game provides the physical info about the world: Static: size of world, model data: mass, centre of gravity, etc. Dynamic: the forces acting on the models Relationships: joints, degrees of freedom, etc The physics engine simulates movement / collisions based on this information

Existing Physics Engines A complete physics engine is very difficult to write Although smaller parts are approachable, e.g. collision detection, particle physics The core component is a program called a solver: Solving simultaneous Newtonian equations Needs precise maths and programming Common to use existing physics engines, e.g: Havok: Commercial engine used widely for games PhysX: Hardware accelerated engine, used on games Bullet: Good free engine, used on some games ODE: Fairly powerful freeware engine SPE: Lightweight, free for non-commercial use We will look at Bullet in the lab

Rigid Body Simulation Physics engines can simulate rigid or soft bodies Note we call them bodies not models in a physics engine Rigid body simulation more straight-forward Handling deformation is difficult Rigid bodies defined by their collision volume or shape The collision volume is usually a simplification of the visual model A car may use box as a volume Or character as a set of boxes and cylinders Can connect them together for more complex models

Collision Primitives Can choose the physics body shape from a set of simple primitives: Box (or cuboid) Sphere (or ellipsoid) Cone Cylinder Rounded cylinder (capsule or chamfer) Each is treated as a precise mathematical object rather than a polygonal mesh This improves the speed of the engine and produces a more accurate simulation and smoother results But simple primitives means inaccurate collision

Complex Collision Volumes What if no suitable collision shape for a model, or precise collisions required? Can combine simple primitives, parenting as appropriate Or can use the (convex) boundary of the polygonal mesh of a model as its collision shape This is called a convex hull Using convex hulls or other high detail volumes increases time and memory required for the physics simulation But will increase accuracy of collision However, detail may bring unwanted side-effects E.g. a polygonal cylinder will not roll as smoothly as a mathematical one, because of its flat sides

Collision Volumes

Physical Properties - Static Each body in has some static physical properties: Mass: amount of matter (how difficult it is to move) Centre of gravity: point of equilibrium of a model Moments of inertia / inertia tensor: how mass is spread around a model (how difficult it is to rotate) When an object has its mass focused at its centre of gravity, it is easy to rotate it around that centre (e.g. a hammer) If the mass is more spread out, it is harder to rotate (e.g. flywheel) Elasticity: bounciness Friction: several types, static, kinetic, rolling Used to apply Newton’s laws of motion And to calculate the effect of interactions with other physics bodies

Physical Properties - Dynamic Each physics engine body also has dynamic properties Position and orientation Linear velocity: current movement Angular velocity: current spin Forces: e.g. gravity, buoyancy, wind Torque: “rotational force”, e.g. engine spinning an axle Impulses: like forces / torques with “instant” effect Damping: Linear and angular slowing of velocities, often used for numerical stability Together this forms the current state of the physics world The initial state is set by the game, then state is dynamically updated by the physics engine

Physical Properties - Relationships Bodies can be connected together These connections usually represent joints: E.g. hinges, ball/socket joint, sliding joints etc. A joint is defined by: The models involved in the joint Degrees of freedom: linear and angular, choice of these determines the joint type Stiffness and springiness Several joints can be used for more complexity E.g. Chains, machines, rag-dolls, etc. Rag-doll: set of primitives connected like a human body Will look at joints in more detail next week

Physics Simulation: Initialisation Create a rigid body in the physics engine for each model in our scene Choosing a suitable collision shape (or shapes) Define the static properties for each body E.g. Mass, centre of gravity Define any joints connecting bodies together Initialise the dynamic properties E.g. Initial position and velocity Make sure to match the model position in 3D engine

Physics Simulation: Update Physics simulation runs in the game loop Typically they use fixed timing E.g. update physics with a 50fps tick (every 0.02s) Physics engines tend to be numerically more stable with fixed timing The game regularly updates the physics engine with changes that affect the world: E.g. forces, torques and impulses on the models Each tick, physics engine calculates a new state (position, velocity etc.) for each body The new positions of the physics bodies are copied to their scene models equivalents

Relationship with Scene Models This implies an important change when working with models that are in the physics simulation There is no need to move or rotate these models Although we may occasionally reposition or reset them Instead we indicate the forces, torques and impulses acting on them And get their positions each frame from their physics bodies A significant shift from previous projects Two views of the same data: 3D model & physics body Can be difficult to have precise control over a model

Practical Issues Physics engines are often numerically unstable Results can be inaccurate/difficult to control Also computationally expensive Can be very slow for complex scenes Settings must be tweaked carefully to achieve efficient and stable results In particular: Don’t calculate physics for stationary bodies Damp velocities so movement is easily stabilised Stop models when they are moving very slowly Limit size of “physics world” to maximise accuracy Plus many other tweaks and optimisations