3.2. I NTRODUCTION TO R EAL - TIME P HYSICS Overview of core principles behind real-time physics systems.

Slides:



Advertisements
Similar presentations
Physics 111: Mechanics Lecture 5
Advertisements

Dr. Steve Peterson Physics 1025F Mechanics NEWTON’S LAWS Dr. Steve Peterson
Kinetics of Particles: Energy and Momentum Methods
Normal Force Force on an object perpendicular to the surface (Fn)
Newton’s Laws (II) Free-body diagrams Normal Force
5. Using Newton’s Laws. Newton’s Third Law 3 Law of Action and Reaction Forces always occur in equal and opposite pairs A B A acts on B B acts on A.
3.3. Introduction to Real-time Physics III
2.1. C OLLISION D ETECTION Overview. Collision detection is used within many types of application, e.g. from robotics, through engineering simulations,
3.6. R ESTING C ONTACTS AND F RICTION Exploration of resting contacts and friction.
MAE 242 Dynamics – Section I Dr. Kostas Sierros.
3.5. C ONTACT R ESOLUTION Resolving a set of contacts.
Color Problem Have a black-box function that returns a bright color in 24-bit RGB Want a paler version of the output What to do?
1.MOMENTUM l Momentum = mass times velocity Units - kg m/s.
Applications of Newton’s Laws
UNC Chapel Hill S. Redon - M. C. Lin Rigid body dynamics II Solving the dynamics problems.
Physics 218: Mechanics Instructor: Dr. Tatiana Erukhimova Sections 818, 819, 820, 821 Lecture 10.
Circular Motion and Other Applications of Newton’s Laws
3.7. O THER G AME P HYSICS A PPROACHES Overview of other game engine physics approaches.
1© Manhattan Press (H.K.) Ltd. Weight Normal reaction Normal reaction 1.2 Different types of forces Tension Tension Elastic force Elastic force Friction.
Lecture VII Rigid Body Dynamics CS274: Computer Animation and Simulation.
Forces Chapter 4.
Newton’s Laws of Motion
Force and Its Representation
Biomechanical movement principles Pages
Physics 215 – Fall 2014Lecture Welcome back to Physics 215 Today’s agenda: Forces Newton’s laws of motion.
3D Graphics for Game Programming Chapter XII Physics-based Simulation.
IMPACT Today’s Objectives: Students will be able to: 1.Understand and analyze the mechanics of impact. 2.Analyze the motion of bodies undergoing a collision,
Mechanics Topic 2.2 Forces and Dynamics. Forces and Free-body Diagrams To a physicist a force is recognised by the effect or effects that it produces.
3.4. C ONTACT G ENERATION Generating contacts between rigid bodies.
Chapter 6 Circular Motion and Other Applications of Newton’s Laws.
Chapter 7 Linear Momentum. MFMcGraw-PHY 1401Chap07b- Linear Momentum: Revised 6/28/ Linear Momentum Definition of Momentum Impulse Conservation.
 Extension of Circular Motion & Newton’s Laws Chapter 6 Mrs. Warren Kings High School.
CHAPTER 4 FORCES IN 1-D FORCE Force is anything which causes a body to start moving when it is at rest, or stop when it is moving, or deflect once it.
Advanced Programming for 3D Applications CE Bob Hobbs Staffordshire university Forces in Human Motion Lecture 4.
Forces and Free-Body Diagrams
Chapter 6 Force and Motion-II. 6.2 Friction Frictional forces are very common in our everyday lives. Examples: 1.If you send a book sliding down a horizontal.
Maths & Technologies for Games Linear Dynamics Particle Based Physics CO3303 Week
Dynamics: Newton’s Laws of Motion. Concepts Force Newton’s First Law of Motion Mass Newton’s Second Law of Motion Newton’s Third Law of Motion Weight.
Linear Momentum Impulse & Collisions. What is momentum?  Momentum is a measure of how hard it is to stop or turn a moving object.  What characteristics.
Chapter: Force and Newton’s Laws
Momentum A measure of how hard it is to stop a moving object. Related to both mass and velocity. Possessed by all moving objects.
© 2007 Pearson Prentice Hall This work is protected by United States copyright laws and is provided solely for the use of instructors in teaching their.
Sport studies biomechanics.
Instructor: Dr. Tatiana Erukhimova
CS274 Spring 01 Lecture 7 Copyright © Mark Meyer Lecture VII Rigid Body Dynamics CS274: Computer Animation and Simulation.
© 2005 Pearson Prentice Hall This work is protected by United States copyright laws and is provided solely for the use of instructors in teaching their.
Dynamics: Newton’s Laws of Motion. Force A force is a push or pull. An object at rest needs a force to get it moving; a moving object needs a force to.
Make sure you got a Bubble sheet and have filled in your student ID number This is NOT a graded quiz—it’s a concept check-point. Answer each question on.
Advanced Games Development Game Physics CO2301 Games Development 1 Week 19.
PHYSICS – Speed, velocity and acceleration. LEARNING OBJECTIVES 1.2 Motion Core Define speed and calculate average speed from total time / total distance.
Concepts for Programming a Rigid Body Physics Engine Part 2 Presented by Scott Hawkins.
Chapter 3: Forces Types of Forces. Review  What is a force?  A force is an interaction between two objects. All forces come in pairs.  All forces are.
Physics 218 Lecture 8: Dynamics Alexei Safonov.
SACE Stage 2 Physics Circular Motion.
Forces. Log into my website, click the Introduction to Forces Notes On a note card, define the following terms: Force Newton Unbalanced force Contact.
Linear Momentum and Collisions
3.7. Other Game Physics Approaches
2.1. Collision Detection Overview.
CHAPTER 4 FORCES IN 1-D.
Physics: Principles with Applications, 6th edition
Chapter Menu Lesson 1: Combining Forces Lesson 2: Types of Force
Unit 1 Our Dynamic Universe Newton’s Laws
Advanced Games Development Game Physics
Forces.
AS-Level Maths: Mechanics 1 for Edexcel
Collisions Chapter 4.
Physics: Principles with Applications, 6th edition
Science Knowledge Organiser – Summer half term 1: Forces. Key concepts
Presentation transcript:

3.2. I NTRODUCTION TO R EAL - TIME P HYSICS Overview of core principles behind real-time physics systems

Important concepts and aspects of use within game physics engines The concepts in this section will be tied together in later lectures.

Closing velocity, collision direction and contact normal, centre of mass, springs, coefficient of restitution

The closing velocity is the total speed at which two objects are moving together, calculated by finding the component of velocity in the direction of one object to the other. In game physics engines, by convention, it is more common to use separating velocity (i.e. opposite direction but same magnitude as closing velocity), given as:

The direction in which two objects are colliding is usually called the “collision normal” or “contact normal.” If two objects, body 1 and 2, are colliding then, by convention, the collision normal is given from the first object’s perspective, i.e. from the first body’s perspective the contact is incoming from the second body, i.e. the normal is

The centre of mass (or “centre of gravity”) is the balance point of an object. Any separating hyperplane passing through the centre of mass will result in two volumes of equal mass. The centre of mass of a sphere or cuboid of uniform density will be located at the geometric centre point. The centre of mass isn’t always contained within the object (e.g. a donut).

Springs have many uses within games, including obvious examples such as a car’s suspension, but also for representing soft and/or deformable bodies. Springs offer a good means of modelling cloth, rope, etc.

Video not available in on-line slides

Hook’s law states that the force exerted by a spring is linearly dependent upon the spring extension or compression from its rest position, i.e. where l holds the spring length, and l 0 the rest length, and k is the spring stiffness). More generally: Where d is a vector representing the current spring’s extension. The force exerted by the spring is equally applied at both ends of the spring, but in opposite directions, i.e. the spring acts to pull/push the objects together/apart in equal measure but in opposite directions. Aside: Real springs are subject to Hook’s law constrained by their limits of elasticity. In game springs can be assumed to have arbitrary wide limits of elasticity.

The application of Hook’s Law can be problematic if applied within an engine that updates the world using discrete steps. A spring with a high stiffness factor combined with a large extension/compression will result in a large applied force. In reality, this force is instantaneous and decreases as soon as the spring moves towards its resting length. Using a discrete time step, there is a danger that the force applied over the whole step will be sufficient to provide a ‘correction’ that results in an even larger expansion/compression in the opposite direction, which in turn, will result in an even greater ‘correction’ in the opposite direction, etc.

When two objects collide, they compress together, and the deformation of their surfaces causes forces to build up that bring the objects apart. From the game physics engine’s point of view this happens instantaneously. The vast majority of collisions behave in a dampened spring like manner as: v’ s is the separating velocity and c is the coefficient of restitution. The coefficient of restitution depends on the materials in collision (different pairs of material will have different coefficients). If the coefficient is 1.0, then the objects will bounce apart with the incident speed. If zero, then the objects coalesce and travel together

Resolve order and resting contacts

An accelerative force acts to change velocity over time. In some cases, e.g. a fast collision, a force is applied over a very short period of time (resulting in a change of velocity). This period of time is too brief to model within the physics engine, hence an ‘instantaneous’ change in velocity is known as an impulse. For forces: For impulses: Aside: Within the physics engine, impulses will not be accumulated, but rather will be instantaneously applied to update a velocity. Normal forces will be accumulated and applied at the end of the simulation step to produce an updated velocity, position, etc.

If an object has two simultaneous contacts, and the engine uses an iterative approach, then resolving one contact may change the other contact. The order in which contacts are resolved is important. A physically plausible approach is to resolve the most severe contact first (i.e. the contact with the lowest separating velocity or highest interpenetration) – this also helps avoid unnecessary work as correcting one contact may entail that other points of contact become separated/separating (and do not need to be further considered). Contact 1 Contact 2

A problem with this approach is when resolving one contact puts another (previously resolved) contact back into collision. For most systems, this can be managed by iterating over contacts until all have been resolved (or an iteration limit reached). The number of iterations should be at least the number of contacts (to give them all a chance of getting seen at least once) and can be greater. More iterations will be needed to resolve a complex, interconnected set of contact. Contact interpenetration increased

Typically, contacts are resolved for closing velocity and interpretation in separate passes, thereby permitting a different ordering when selecting which contact is to be resolved (based on the separating velocity or interpenetration depth). If the stages are combined then no one single optimal ordering is likely possible. Aside: The number of iterations used to resolve interpenetration might not necessarily be the same as the number used to resolving collisions

Consider the simulation of a particle resting on the ground and subject to gravity. In the first frame the particle accelerates downward, introducing a non-zero velocity. In the second frame the position is updated, and the velocity increases again. Now it has begun to interpenetrate with the ground. The collision detector picks up on the interpenetration and generates a collision. The contact resolver looks at the particle, corrects the interpenetration and applies a collision response from the contact with the ground (based on closing velocity, material restitutions, etc.). The generated upward velocity will be small, but it may be enough to be noticed given a long frame time.

One approach (using micro collisions) towards solving the problem is: Detecting the problem earlier (i.e. smaller velocity to correct) by returning contacts that are nearly, but not quite interpenetrating. If the particular object was stationary in the previous frame and the generated velocity is only due to gravity, then consider it to be a resting contact, and apply an impulse that will result in a zero separating velocity. In effect, the series of micro-collisions keep the objects apart.

A more physically realistic approach to handling resting contacts is to apply an upwards force from the ground, pushing the object back so that its total acceleration in the vertical direction becomes zero. Whilst more realistic, this approach is also considerably more complex as there may be multiple points of contact between the body and the ground (i.e. some means of deciding how the resting forces should be distributed across the various points of contact is needed).

Consult the recommended course text book for: Development of a range of force generators, including one for gravity and another for a drag force generator Development of spring based force generators – including basic spring, anchored spring, elastic bungee generator, buoyancy force generator, Development of a cable and rod constraint class Development of a simple particle physics engine (based on implementation of Netwon’s first and second laws) and a mass- aggregate physics engine

Directed physics reading Directed reading

Directed reading Read Chapter 5 of Game Physics Engine Development (pp69-79) on adding forces. Read Chapter 6 of Game Physics Engine Development (pp81-101) on modelling springs.

To do: Read the directed reading. Consider if you might wish to develop your own physics engine as your project. Today we explored: Range of important physical concepts. Range of important modelling concepts.