1 / 68

Chapter 12: Mechanics 2: Linear & Rotational Dynamics

Chapter 12: Mechanics 2: Linear & Rotational Dynamics. Ian Parberry University of North Texas. Fletcher Dunn Valve Software. 3D Math Primer for Graphics & Game Development . What You’ll See in This Chapter.

heremon
Télécharger la présentation

Chapter 12: Mechanics 2: Linear & Rotational Dynamics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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. 3D Math Primer for Graphics & Game Dev

  3. Word Cloud 3D Math Primer for Graphics & Game Dev

  4. Section 12.1:Newton’s 3 Laws 3D Math Primer for Graphics & Game Dev

  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.) 3D Math Primer for Graphics & Game Dev

  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. 3D Math Primer for Graphics & Game Dev

  7. Newton’s Second Law The acceleration of a body is proportional to (and in the same direction as) the net external force acting on the body, and inversely proportional to the mass of the body: . 3D Math Primer for Graphics & Game Dev

  8. The Force Force is a vector. It has units like kg.m/sec2, also called a Newton. “Duct tape is like the force. It has a light side, a dark side, and it holds the universe together.” (Carl Zwanzig) 3D Math Primer for Graphics & Game Dev

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

  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. 3D Math Primer for Graphics & Game Dev

  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 1st and 2nd laws. A robot in a falling elevator is in a noninertialframe. He must invent a fictitious upward force to counteract gravity to explain why his herring sandwich doesn’t fall. 3D Math Primer for Graphics & Game Dev

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

  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. 3D Math Primer for Graphics & Game Dev

  14. 3D Math Primer for Graphics & Game Dev

  15. Example There are four forces here. Moe pushing the box. The box pushing Moe. Moe pushing the Earth. The Earth pushing Moe. Note that and cancel out. 3D Math Primer for Graphics & Game Dev

  16. Consequence of Newton’s 3rd 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. 3D Math Primer for Graphics & Game Dev

  17. Section 12.2:Some Simple Force Laws 3D Math Primer for Graphics & Game Dev

  18. Gravity in the Real World Newton’s Law of Universal Gravitation: where is the magnitude of the force, and are the masses of the two objects, and is the distance between their centers of mass, and . 3D Math Primer for Graphics & Game Dev

  19. Video Game Gravity , where . This is not physically accurate, but then again, neither is being able to jump two or three times your own height, steer in midair, or double jump. When it comes to jumping in video games, reality is not just overrated, it's completely ignored. It just doesn't feel right. 3D Math Primer for Graphics & Game Dev

  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. 3D Math Primer for Graphics & Game Dev

  21. Video Game Gravity Simulating a jump mechanic using a value of may be even worse, because most players expect a jump to take a certain amount of time but also expect to be capable of jumping to unrealistic heights. When real-world gravity is used to attain these heights, the player is in the air too long, and it feels “floaty”. Many arcade racing games increase gravity to get the car back on the ground quickly. The player wants to be in full control again as quickly as possible, and waiting for real-world gravity to get them back down usually takes too long. There are other racing games that use a value of gravity that is less than the real world value, to facilitate unrealistic jumps at realistic vehicle speeds. 3D Math Primer for Graphics & Game Dev

  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. Inother 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. 3D Math Primer for Graphics & Game Dev

  23. Realism versus Entertainment What “feelsright" 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. 3D Math Primer for Graphics & Game Dev

  24. Friction The standard dry friction model is sometimes called Coulomb friction. Charles-Augustinde Coulomb (1736-1806). (Image from Wikimedia Commons.) 3D Math Primer for Graphics & Game Dev

  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. 3D Math Primer for Graphics & Game Dev

  26. Static Friction The following equation is a good approximation for the maximum magnitude of static friction: . is a constant called the coefficient of static friction that depends on the type of surfaces rubbing together.Just look it up in a table. is the magnitude of the normal force. 3D Math Primer for Graphics & Game Dev

  27. 3D Math Primer for Graphics & Game Dev

  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. 3D Math Primer for Graphics & Game Dev

  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. 3D Math Primer for Graphics & Game Dev

  30. Not Sliding On the Brink Sliding 3D Math Primer for Graphics & Game Dev

  31. Kinetic Friction Once static friction is overcome and the object is moving, friction continues to push against the relative motion of the two surfaces. This is called kinetic friction. The magnitude kinetic friction is generally less than that of static friction. It’s computed the same way of static friction: . 3D Math Primer for Graphics & Game Dev

  32. 3D Math Primer for Graphics & Game Dev

  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. 3D Math Primer for Graphics & Game Dev

  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. 3D Math Primer for Graphics & Game Dev

  35. Control Systems There are two types of spring motion, damped oscillation and undampedoscillation. Avirtual 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. 3D Math Primer for Graphics & Game Dev

  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. Ifwe 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. 3D Math Primer for Graphics & Game Dev

  37. Rest length Compress Stretch 3D Math Primer for Graphics & Game Dev

  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). 3D Math Primer for Graphics & Game Dev

  39. Hooke’s Law Where is the spring constant that describes how stiff the spring is, is the spring’s rest length, and is the length that the spring has been stretched or compressed to. 3D Math Primer for Graphics & Game Dev

  40. Rewriting Hooke’s Law Things get easier if we adopt a reference frame where the position x = 0 designates the rest position, in which the spring has its rest length and there are no restorative forces. Let Since contains both the spring constant and the mass of the particle , it measures the spring's ability to accelerate a particle at its end. 3D Math Primer for Graphics & Game Dev

  41. Rewriting Hooke’s Law With those notational changes, we can rewrite Hooke’s Law as , where is acceleration as a function of time and is position as a function of time. This is called a differential equation, since it is an equation in both position and its second derivative, acceleration . 3D Math Primer for Graphics & Game Dev

  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: 3D Math Primer for Graphics & Game Dev

  43. Solving Our Differential Equation This function ought to look familiar to you: it's the graph of the cosine function. Let's see what happens if we just try as our position function. Differentiating twice to get the velocity and acceleration functions, we get: which is close, but we're missing the factor of . 3D Math Primer for Graphics & Game Dev

  44. Does Matter? To understand where should appear in , consider what happens to the graph of when we change the value of . In other words, we repeat our physical experiment and vary the stiffness of the spring. The result is that larger values of (stiffer springs) result in a graph that is horizontally compressed: the frequency of oscillation is increased. Likewise, smaller values of K cause the spring to oscillate more slowly, and the graph is expanded. 3D Math Primer for Graphics & Game Dev

  45. How Much Does Matter? Furthermore, we observe that the frequency is proportional to the square root of . For example, when we increase by a factor of four, the frequency doubles. This gives us a hint as to where should appear, since all we are doing is scaling the time axis. 3D Math Primer for Graphics & Game Dev

  46. Angular Frequency The quantity is called the angular frequency and comes up often enough that we find it helpful to introduce the notation = and we can write the solution as 3D Math Primer for Graphics & Game Dev

  47. Three More Degrees of Freedom There are some degrees of freedom inherent in the motion of the spring that we have not accounted for. We are not accounting for the maximum displacement, known as the amplitude of the oscillations and denoted . Our equation always has an amplitude of 1. We are assuming that , meaning the spring was initially stretched to the maximum displacement and released with zero initial velocity. However, in general, we could have pulled it to displacement and then given it a shove so it has initial velocity . 3D Math Primer for Graphics & Game Dev

  48. The Three are Two It would appear that we have three more variables that need to be accounted for in our equation if it is going to be completely general. As it turns out, the three variables we have just discussed (the amplitude, initial position, and initial velocity) are interrelated. If we pick any two, the value for the third is fixed. We'll keep as is, but we'll replace and with the phase offset , which describes where in the cycle the spring is at . Adjustments to the phase offset have the simple effectof shifting the graph horizontally on the time axis. 3D Math Primer for Graphics & Game Dev

  49. Simple Harmonic Motion Adding these two variables, we arrive at the general solution, the equations of simple harmonic oscillation: 3D Math Primer for Graphics & Game Dev

  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. 3D Math Primer for Graphics & Game Dev

More Related