Simulation Engines TDA571|DIT030 Physics Tommaso Piazza 1
Administrative stuff Group project presentation Friday, 18 December at 10.00 sharp Presentation using i.e. Powerpoint The extensions made by every member of the group The simulation engine that has been put together Tech demo Use terms that make it easy for people from the outside to understand your work Use plenty of screenshots Diagram of system architecture Show movie if applicable Walkthrough of the tech demo 15 minutes including questions IDC | Interaction Design Collegium 2
Administrative stuff Group report The group report should describe the work done as well as the final result 14-18 pages in total Filename simEngines-g#-GroupPresentation in your group’s folder on Google Docs Deadline Monday, 11 January 24.00 IDC | Interaction Design Collegium 3
Administrative stuff: Contents of group report Design (for each extension) Conclusion Classes Introduction Interaction Purpose Implementation (for each extension) Goals Integration and testing Pre-study Tech demo How does the system look today? Description What did you want to make better? Design Project plan and division of themes Implementation Specification of demands (for each extension) Results Functional demands (functionality) Screenshots Non-functional demands (properties) Performance Analysis Conclusions Conceptual model List of sources Architecture Appendixes: Extension proposals Link to the code repository on Google Code IDC | Interaction Design Collegium 4
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 simEngines-g#-YourName-Report in your group’s folder on Google Docs Deadline Monday, 11 January 24.00 IDC | Interaction Design Collegium 5
Administrative stuff: Other stuff to do Source code and data Should be Google Code, put the link in you group report 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 IDC | Interaction Design Collegium 6
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... IDC | Interaction Design Collegium 7
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 IDC | Interaction Design Collegium 8
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” IDC | Interaction Design Collegium 9
Demo movies - Havok IDC | Interaction Design Collegium 10
Demo movies - Havok IDC | Interaction Design Collegium 11
Demo movies - Physix IDC | Interaction Design Collegium 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 IDC | Interaction Design Collegium 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 IDC | Interaction Design Collegium 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 = F1 x F2 To find the shortest distance from a point to a plane in space, we use the dot product IDC | Interaction Design Collegium 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 IDC | Interaction Design Collegium 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 IDC | Interaction Design Collegium 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 on the right IDC | Interaction Design Collegium 18
Moment of inertia The moment of inertia describes the radial distribution of mass in the body . It measures an object's resistance to changes in its rotation rate 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 * d2 IDC | Interaction Design Collegium 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 IDC | Interaction Design Collegium 20
Recommend
More recommend