Download presentation

Presentation is loading. Please wait.

Published byTianna Divers Modified over 3 years ago

1
Chapter 12: Mechanics 2: Linear & Rotational Dynamics Ian Parberry University of North Texas Fletcher Dunn Valve Software 3D Math Primer for Graphics & Game Development

2
What You’ll See in This Chapter This chapter considers the cause of motion, its orientation, and how we might go about simulating it on a computer. It is divided into six sections. Section 12.1 gives an overview of Newton’s 3 laws. Section 12.2 talks about the cause of motion: the force. Section 12.3 introduces momentum. Section 12.4 looks at collisions and impulse. Section 12.5 is about rotational dynamics. Section 12.6 discusses digital simulation of mechanics. Chapter 12 Notes3D Math Primer for Graphics & Game Dev2

3
Word Cloud Chapter 11 Notes3D Math Primer for Graphics & Game Dev3

4
Section 12.1: Newton’s 3 Laws Chapter 12 Notes3D Math Primer for Graphics & Game Dev4

5
Sir Isaac Newton Sir Isaac Newton established three simple laws that provide a framework, which we call Newtonian or classical mechanics. It doesn’t hold at high speeds or small distances, but it’s good enough for everyday life, and video games. (Image from Wikimedia Commons.) Chapter 12 Notes3D Math Primer for Graphics & Game Dev5

6
Newton’s First Law Every body persists in its state of being at rest or of moving uniformly straight forward, except insofar as it is compelled to change its state by force impressed. Chapter 12 Notes3D Math Primer for Graphics & Game Dev6

7
Newton’s Second Law Chapter 12 Notes3D Math Primer for Graphics & Game Dev7

8
The Force Chapter 12 Notes3D Math Primer for Graphics & Game Dev8

9
Free Body Diagram Starting with a representation of the object. 1.Draw and label all the forces acting on it. 2.Sum those forces (using vector addition) to compute the net force. 3.Use Newton's 2 nd law to compute the acceleration of the object. 4.Integrate the acceleration to determine the motion of the object. Chapter 12 Notes3D Math Primer for Graphics & Game Dev9

10
Differential Equations When solving problems analytically, this means solving differential equations. We don't use any differential equations in this book because there are only a few simple cases that we will look at analytically. Numerical methods of integration must be used. Later, we examine Euler integration, which is the most simple method imaginable, but also the one used by most real- time rigid body simulators. Chapter 12 Notes3D Math Primer for Graphics & Game Dev10

11
Inertial Reference Frames This only works in a reference frame that is not accelerating. You have to invent fictional forces to explain why objects are not accelerating according to Newton’s 1 st and 2 nd laws. A robot in a falling elevator is in a noninertial frame. He must invent a fictitious upward force to counteract gravity to explain why his herring sandwich doesn’t fall. Chapter 12 Notes3D Math Primer for Graphics & Game Dev11

12
Chapter 12 Notes3D Math Primer for Graphics & Game Dev12 To a passing alien who is not accelerating, Newton’s laws work just fine, and there is no need to invent a fictional force.

13
Newton’s Third Law To every action there is always an equal and opposite reaction. Or, the forces of two bodies on each other are always equal and are directed in opposite directions. Chapter 12 Notes3D Math Primer for Graphics & Game Dev13

14
Chapter 12 Notes3D Math Primer for Graphics & Game Dev14

15
Example Chapter 12 Notes3D Math Primer for Graphics & Game Dev15

16
Consequence of Newton’s 3 rd Law As long as the internal forces cancel out, we are justified in representing a complex body by a single point or particle. This is called rigid body dynamics. Chapter 12 Notes3D Math Primer for Graphics & Game Dev16

17
Section 12.2: Some Simple Force Laws Chapter 12 Notes3D Math Primer for Graphics & Game Dev17

18
Gravity in the Real World Chapter 12 Notes3D Math Primer for Graphics & Game Dev18

19
Video Game Gravity Chapter 12 Notes3D Math Primer for Graphics & Game Dev19

20
Video Game Gravity In most first-person shooters, when you jump, you are given an initial burst of upward velocity, and then your position is simulated just like every other airborne object in the world. In most third-person games your character will spring up almost instantaneously and reach a maximum height very quickly. In many games the character will hover there, then slam back down on the ground as quickly as it rose up, perhaps leaving a crater behind. Chapter 12 Notes3D Math Primer for Graphics & Game Dev20

21
Video Game Gravity Chapter 12 Notes3D Math Primer for Graphics & Game Dev21

22
Video Game Gravity There are also reasons to fiddle with gravity for non- player-character objects as well. Sometimes real-world gravity can create an “objects made of styrofoam” feeling, so gravity is increased to get an object to tip over and come to rest more quickly. In other situations, an artificially low value of gravity can make a large object seem even more massive (especially when accompanied by the right sound effects), because acceleration on Earth is constant and is one of a few cues humans instinctively use to establish an absolute scale for objects in the distance. Chapter 12 Notes3D Math Primer for Graphics & Game Dev22

23
Realism versus Entertainment What “feels right" is a subjective matter. It is based more on player expectation than physical reality. In the end, what matters most in a video game is not what's going on in the CPU or even on the screen, but what is going on in the player's mind. The human mind is highly susceptible to suggestion. The quest for realism should never be an end unto itself. A successful video game will harness realism only where it serves the ultimate goal, which is entertainment. Chapter 12 Notes3D Math Primer for Graphics & Game Dev23

24
Friction The standard dry friction model is sometimes called Coulomb friction. Charles-Augustin de Coulomb (1736-1806). (Image from Wikimedia Commons.) Chapter 12 Notes3D Math Primer for Graphics & Game Dev24

25
Static Friction When an object is at rest on top of another object, a certain amount of force is required to get it unstuck and set it in motion. If any less force is applied, the force of friction will push back with a counteracting force up to some maximum amount. This is called static friction. Chapter 12 Notes3D Math Primer for Graphics & Game Dev25

26
Static Friction Chapter 12 Notes3D Math Primer for Graphics & Game Dev26

27
Chapter 12 Notes3D Math Primer for Graphics & Game Dev27

28
The Normal Force The normal force is the force acting perpendicular to the surfaces that prevent them from overlapping. For example, when an object (such as a bowl of petunias) is resting on top of another object (such as a table), the normal force is the force required to counteract gravity. It is the force required to counteract the component of gravity that acts perpendicular to the surfaces. Chapter 12 Notes3D Math Primer for Graphics & Game Dev28

29
Normal and Lateral Components If the table is at an incline, then we can separate gravity into a normal component and a lateral component. Inside a computer, we describe the orientation of the table with a normal vector, and use the dot product to separate gravity into the relative and normal components. Since the bowl and the table do not accelerate relative to each other, we know that the normal force of the table pushing against the bowl must be exactly equal to the normal component of the force of gravity pulling the bowl towards the table. Chapter 12 Notes3D Math Primer for Graphics & Game Dev29

30
Chapter 12 Notes3D Math Primer for Graphics & Game Dev30 Not SlidingOn the BrinkSliding

31
Kinetic Friction Chapter 12 Notes3D Math Primer for Graphics & Game Dev31

32
Chapter 12 Notes3D Math Primer for Graphics & Game Dev32

33
Coulomb’s Law of Friction The direction of the force of kinetic friction is always opposed to the relative motion of the surfaces. As we said earlier, the coefficient of kinetic friction is usually less than the coefficient of static friction. Thus, if we increase the angle of the table slowly so that static friction is just overcome, the petunias will begin to accelerate. Coulomb's primary contribution to the theory, sometimes called Coulomb's law of friction, was that the force of kinetic friction does not depend on the relative velocities of the surfaces. Chapter 12 Notes3D Math Primer for Graphics & Game Dev33

34
Spring Forces Even if you don't see very many actual springs in a video game, there are likely very many virtual springs at work. Springs exhibit a general behavior that is very useful for enforcing constraints, for example, preventing objects from overlapping, cloth rendering, and rag-doll character animation. Chapter 12 Notes3D Math Primer for Graphics & Game Dev34

35
Control Systems There are two types of spring motion, damped oscillation and undamped oscillation. A virtual spring (often in the form of a spring- damper system) is a type of control system. There are certain advantages to be had when the physical nature of the problem is dropped and we think of it purely in mathematical terms. Indeed, many times the problem was never really physical to begin with, and was only recast in physical terms so that the spring-damper apparatus could be applied. Chapter 12 Notes3D Math Primer for Graphics & Game Dev35

36
The Rest Length Consider a spring with one end fixed and the other end free to move in one dimension. When the spring is at equilibrium with no external forces on it, it has a natural length, called the rest length. If we stretch the spring, then it will pull back to try to regain its rest length. Likewise, if we compress the spring, it will push back. Chapter 12 Notes3D Math Primer for Graphics & Game Dev36

37
Chapter 12 Notes3D Math Primer for Graphics & Game Dev37 Rest length Compress Stretch

38
Hooke’s Law Robert Hooke (1635 –1703). (Image from Wikimedia Commons.) The magnitude of the restorative force is proportional to the distance from the rest length (provided the force does not exceed the elastic limit of the material used to construct the spring). Chapter 12 Notes3D Math Primer for Graphics & Game Dev38

39
Hooke’s Law Chapter 12 Notes3D Math Primer for Graphics & Game Dev39

40
Rewriting Hooke’s Law Chapter 12 Notes3D Math Primer for Graphics & Game Dev40

41
Rewriting Hooke’s Law Chapter 12 Notes3D Math Primer for Graphics & Game Dev41

42
Solving Differential Equations We don’t have the tools to solve general differential equations, but this one is not too hard. If we grab a spring and experimentally graph the position of its end as a function of time after compression, we get a graph like this: Chapter 12 Notes3D Math Primer for Graphics & Game Dev42

43
Solving Our Differential Equation Chapter 12 Notes3D Math Primer for Graphics & Game Dev43

44
Chapter 12 Notes3D Math Primer for Graphics & Game Dev44

45
Chapter 12 Notes3D Math Primer for Graphics & Game Dev45

46
Angular Frequency Chapter 12 Notes3D Math Primer for Graphics & Game Dev46

47
Three More Degrees of Freedom Chapter 12 Notes3D Math Primer for Graphics & Game Dev47

48
The Three are Two Chapter 12 Notes3D Math Primer for Graphics & Game Dev48

49
Simple Harmonic Motion Chapter 12 Notes3D Math Primer for Graphics & Game Dev49

50
Damping Forces So far, we have been studying a physically nonexistent situation in which the spring will oscillate forever. In reality, there are usually at least two more interesting forces, driving force and friction. The driving force is an external force, that acts as the input to the system and causes the motion to begin. Friction we have already met. The general term used to describe any effect that tends to reduce the amplitude of an oscillatory system is damping, and we call oscillation where the amplitude decays over time damped oscillation. Damping forces are useful in video games, so let's discuss them in more detail. Chapter 12 Notes3D Math Primer for Graphics & Game Dev50

51
Damping Force Chapter 12 Notes3D Math Primer for Graphics & Game Dev51

52
Qualitative Observations The damping force has an extremely simple form, but things get interesting when we study motion over time. Qualitatively, we can make some basic predictions about how damped oscillation of a spring would differ from undamped oscillation of the same spring. The more obvious prediction is that we would expect the amplitude of oscillation to decay over time. Like the force of friction, damping removes energy from the system. The second observation is only slightly less obvious: Since damping in general slows the velocity of the mass on the end of the spring, we would expect the frequency of oscillation to be reduced compared to undamped oscillation. Those two intuitive predictions turn out to be correct, although, of course, to be more specific we will need to analyze the math. Chapter 12 Notes3D Math Primer for Graphics & Game Dev52

53
Harmonic Motion with Damping Forces Chapter 12 Notes3D Math Primer for Graphics & Game Dev53

54
Spring-Damper Systems in Video Games Spring-damper systems are used in video games as control systems. A control system takes as input a function of time that represents some target value. For example: 1.Camera code might compute a desired camera position based on the player's position each frame; 2.AI code might determine an exact targeting angle for an enemy; 3.We may have a desired player character velocity based on the instantaneous amount of control stick deflection; 4.We might have a desired screen-space position for some highlight effect, based on the currently selected choice in a menu. Chapter 12 Notes3D Math Primer for Graphics & Game Dev54

55
The Set Point The current value of the input signal is known as the set point in control system terminology. The set point is essentially the rest position of the spring, and the input signal is like somebody taking the other end of the spring and yanking it around. It is similar to a driving force, but we are given a function describing a position rather than a force or acceleration. Chapter 12 Notes3D Math Primer for Graphics & Game Dev55

56
What Does a Control System Do? The job of any control system is to take this input signal and produce an output signal. Using our examples from 2 slides ago, the output signal might be (respectively): 1.The camera position to use for each frame 2.The animated targeting angle the enemy will use to aim the weapon, 3.The player character velocity. 4.The screen-space position of the highlight. Chapter 12 Notes3D Math Primer for Graphics & Game Dev56

57
No Jerks Allowed For many control systems, the actual position and set point are not used; rather, only the error is needed. Of course, an obvious question is, if we know the desired value, why don't we just use that directly? Because it's too jerky. In the same way that the shocks and springs on a car don't just pass along the elevation of the road directly to the car, a control system in a video game is often designed to smooth out the bumps caused by sudden state changes that might make the camera snap to a new position or the player jerk into motion. Chapter 12 Notes3D Math Primer for Graphics & Game Dev57

58
PD Controllers The camera or screen-space highlight are nonphysical examples in which the quantity of mass is not really appropriate and is dropped. But the differential equations are still the same, and they have the same solution. Stripped of the spring metaphor, we are left with what is known as a PD controller. The P stands for proportional, and this is the spring part of the controller, since it is proportional to the current error. The damper is the D part, which stands for derivative, because the action of the damper at any given instant is proportional to the derivative (the velocity). Chapter 12 Notes3D Math Primer for Graphics & Game Dev58

59
Don’t Reinvent the Wheel (Or the Spring) PD controllers (and their more robust cousin, the PID controller, where the I stands for integral and is used to remove steady-state error) are broadly applicable tools. They have been standard engineering tools for decades (centuries?) and are well understood. Nevertheless, they are one of the most frequently reinvented wheels in video game programming. Chapter 12 Notes3D Math Primer for Graphics & Game Dev59

60
Chapter 12 Notes3D Math Primer for Graphics & Game Dev60

61
Tuning Chapter 12 Notes3D Math Primer for Graphics & Game Dev61

62
Alternatives and Generalizations Chapter 12 Notes3D Math Primer for Graphics & Game Dev62

63
Section 12.3: Momentum Chapter 12 Notes3D Math Primer for Graphics & Game Dev63

64
Moe’s Box Chapter 12 Notes3D Math Primer for Graphics & Game Dev64

65
Section 12.4: Impulsive Forces and Collisions Chapter 12 Notes3D Math Primer for Graphics & Game Dev65

66
Section 12.5: Rotational Dynamics Chapter 12 Notes3D Math Primer for Graphics & Game Dev66

67
Section 12.6: Real-Time Rigid Body Simulators Chapter 12 Notes3D Math Primer for Graphics & Game Dev67

68
That concludes Chapter 12. Next, Chapter 13: Curves in 3D Chapter 12 Notes3D Math Primer for Graphics & Game Dev68

Similar presentations

Presentation is loading. Please wait....

OK

Chapter 4 Preview Objectives Force Force Diagrams

Chapter 4 Preview Objectives Force Force Diagrams

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on tuberculosis Ppt on central limit theorem video Ppt on trade fair international Ppt on energy giving food group Ppt on nationalism in india for class 10th Ppt on holographic technology for health Ppt on french revolution for class 9th Ppt on healthy eating habits Ppt on hepatitis b vaccine Ppt on event driven programming code