physics
play

Physics Simulation Engines 2008 Chalmers University of Technology - PowerPoint PPT Presentation

Physics Simulation Engines 2008 Chalmers University of Technology Markus Larsson markus.larsson@slxgames.com 08-12-01 Simulation Engines 2008, Markus Larsson 1 Administrative stuff No lecture on Wednesday 08-12-01 Simulation Engines 2008,


  1. Physics Simulation Engines 2008 Chalmers University of Technology Markus Larsson markus.larsson@slxgames.com 08-12-01 Simulation Engines 2008, Markus Larsson 1

  2. Administrative stuff No lecture on Wednesday 08-12-01 Simulation Engines 2008, Markus Larsson 2

  3. Administrative stuff  Group report  The group report should describe the work done as well as the final result  14-18 pages in total  Filename  groupreport_group_X.pdf 08-12-01 Simulation Engines 2008, Markus Larsson 3

  4. Administrative stuff: Contents of group report Conclusion Design (for each extension)   Classes  Introduction  Interaction  Purpose  Goals Implementation (for each extension)   Prestudy Integration and testing   How does the system look today?  Tech demo  What did you want to make better?  Description  Project plan and division of themes  Design  Specification of demands (for each Implementation   extension) Results  Functional demands (functionality)  Screenshots  Non-functional demands  Performance  (properties) Conclusions  Analysis  List of sources  Conceptual model  Appendixes: Extension proposals  Architecture  08-12-01 Simulation Engines 2008, Markus Larsson 4

  5. Administrative stuff: Individual report 6-8 pages  Contents   Description of work tasks assigned to you and your role in the group's work  Description of your own contributions to the end result  Evaluation of your own work  Evaluation of the group's work  Description of the experiences and knowledge you have acquired in planning, designing, group dynamics and technical knowledge Project diary as an appendix  File name   report_your_name.pdf 08-12-01 Simulation Engines 2008, Markus Larsson 5

  6. Administrative stuff: Other stuff to do  Source code and data  Should be in the group's file area when you hand in your reports  Put a readme.txt in the root of the file area  How to compile your code  How to run your tech demo  Anything else you can think of to aid me in accessing your work 08-12-01 Simulation Engines 2008, Markus Larsson 6

  7. Introduction  Today's lecture will be about physics  Not so long ago physics in games were nothing but pure cheating  Physics in modern games are extremely advanced and there is a lot of interest in the topic at the moment  Third party solutions are used most of the time  PhysX, Havok, Newton, Bullet, ODE, etc... 08-12-01 Simulation Engines 2008, Markus Larsson 7

  8. Why let physics do your physics Why are we bothering with simulating real-world physics in a game?   Only interesting for simulations? Verisimilitude   Players want computer games to “feel” realistic in some way in order to suspend their disbelief  The atmosphere of the game will be quite spoiled if characters and objects in the game do not behave at all as you would expect them to  It’s important to note that verisimilitude literally means “possessing the appearance of truth”  We do not mind if what we model is not real as long as it feels real – in fact, we seldom want to model the exact real properties of a physical process 08-12-01 Simulation Engines 2008, Markus Larsson 8

  9. Why let physics do your physics  Productivity  Just like in the case with AI characters, we can use scripting to make objects in our world behave realistically  Would take a lot of effort and fine-tuning to make it look good  If we introduce a general physics framework into our game, we just have to specify physical properties of our game objects and essentially get their behaviors for “free” 08-12-01 Simulation Engines 2008, Markus Larsson 9

  10. Demo Bullet integrated into the Blender project 08-12-01 Simulation Engines 2008, Markus Larsson 10

  11. Using a physics engine  Keywords  Callbacks  Bounding volumes  Convex hulls  Different physics engines interface quite differently, but they tend to be callback-based 08-12-01 Simulation Engines 2008, Markus Larsson 11

  12. Fundamentals  In order to understand physics engines we must understand the fundamentals of mechanics  We will be using SI-units in our treatment of physics  Length meter: m  Mass kilogram: kg  Time second: s  Electric current ampere: A  Thermodynamic temperature kelvin: K  Amount of substance mole: mol  Luminous intensity candela: cd  To us, length, mass and time are interesting 08-12-01 Simulation Engines 2008, Markus Larsson 12

  13. Newton's laws of motion Sir Isaac Newton formulated three basic laws of motion in his  Philosophiae Naturalis Principia Mathematica  A body tends to remain at rest or continue to move in a straight line at constant velocity unless it is acted upon by an external force. This is the concept of inertia.  The acceleration of a body is proportional to the resultant force acting on the body, and this acceleration is in the same direction as the resultant force.  For every force acting on a body (action) there is an equal and opposite reacting force (reaction) in which the reaction is collinear to the acting force. Main lesson: F = ma  08-12-01 Simulation Engines 2008, Markus Larsson 13

  14. Vectors and coordinate systems We use a right-handed Cartesian coordinate space for both 2D and  3D Vectors are denoted as F , where F is the magnitude, and Fx, Fy, and  Fz are the components along the coordinate axes Important vector operations include the cross product and dot product  To find the normal of a plane, we use N = F 1 x F 2  To find the shortest distance from a point to a plane in space, we use  the dot product 08-12-01 Simulation Engines 2008, Markus Larsson 14

  15. Mass properties Formally speaking, our treatment on mechanics will focus on rigid bodies  Bodies made up of particles where each particle maintains a fixed  position relative to its neighbors with no rotation or translation I.e. bodies that do not change shape  Mass  The amount of matter in a body; a measure of a body’s resistance to  linear motion Center of mass  The point in a body around which its mass is evenly distributed; also  the single point where applying a force will not result in a rotation of the body Moment of inertia  Radial distribution of mass of a body about a given axis of rotation; a  measure of a body’s resistance to rotational motion 08-12-01 Simulation Engines 2008, Markus Larsson 15

  16. Mass  Finding the mass of a body entails summing up the mass of the individual particles making up the body  The mass of each particle is then the product of its density and its volume  Given a body of uniform density, the total mass of the body is simply the product of the density and the volume  In most cases, our bodies are not of uniform density, however; a car consists of many different parts with different shapes and densities  Complex bodies are approximated using a collection of simple bodies and sum up their masses for a total mass for the whole body 08-12-01 Simulation Engines 2008, Markus Larsson 16

  17. Center of mass Deriving the center of mass of a body is a  little more complex than deriving its mass  We again need to split the body into infinite particles and sum up their first moment in the local coordinate system and then dividing by the total mass to get the actual coordinates  Since we are dealing with finite bodies making up more complex bodies, we can simply sum them up using the formula below 08-12-01 Simulation Engines 2008, Markus Larsson 17

  18. Moment of inertia The moment of inertia describes the radial distribution of mass in the  body  Calculated by summing the second moment of mass elements in the body  The lever is no longer the distance to the center of mass along the coordinate axis, but the perpendicular distance from the coordinate axis for which we are calculating the moment of inertia  The second moment is m * d 2 08-12-01 Simulation Engines 2008, Markus Larsson 18

  19. Moment of inertia We will not go into detail about this computation   Calculating the moment of inertia for an arbitrary object is difficult – often we simplify a complex body into a set of simple bodies for which formulas have already been derived The moment of inertia is defined for rotations around a specific  axis  Represented by a scalar in 2D  In 3D, a body can rotate around an arbitrary axis, so we use a 3x3 matrix (inertia tensor) called I A tensor is a mathematical entity that has both a magnitude and  a direction  A vector is a first-rank tensor  A 3D inertia matrix is a second-rank tensor 08-12-01 Simulation Engines 2008, Markus Larsson 19

  20. Force  Forces are everywhere  It affects all bodies and influences the acceleration of objects according to Newton's laws of motion  One of the first tasks of describing a mechanics problem is to isolate the forces acting upon a body in order to model it in a simulation  This is also the main task when defining objects in a computer game with a physics engine  Note that forces have both a magnitude (measured in Newton; 1 N = 1 kg m/s2) and a direction; thus we use vector notation to describe a force: F . 08-12-01 Simulation Engines 2008, Markus Larsson 20

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend