PSE Game Physics. Session (3) Springs, Ropes, Linear Momentum and Rotations. Atanas Atanasov, Philipp Neumann, Martin Schreiber

Similar documents
PSE Game Physics. Session (6) Angular momentum, microcollisions, damping. Oliver Meister, Roland Wittmann

Simulation in Computer Graphics Elastic Solids. Matthias Teschner

GAME PHYSICS ENGINE DEVELOPMENT

Physics I: Oscillations and Waves Prof. S. Bharadwaj Department of Physics and Meteorology. Indian Institute of Technology, Kharagpur

CS-184: Computer Graphics

PH 2213 : Chapter 05 Homework Solutions

Chapter 5 Force and Motion

PHYSICS. Chapter 5 Lecture FOR SCIENTISTS AND ENGINEERS A STRATEGIC APPROACH 4/E RANDALL D. KNIGHT Pearson Education, Inc.

Physics 2211 ABC Quiz #4 Solutions Spring 2017

Notes Momentum. Momentum and Impulse. - The product (multiplication) of an objects mass and velocity is called momentum.

Section /07/2013. PHY131H1F University of Toronto Class 9 Preclass Video by Jason Harlow. Based on Knight 3 rd edition Ch. 5, pgs.

Particle Systems. CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2017

UNIT III. CS1117 VIRTUAL REALITY 7 th SEM CSE

Remove this sheet AFTER the exam starts and place your name and section on the next page.

Physics 140 D100 Midterm Exam 2 Solutions 2017 Nov 10

Frames of reference. Objectives. Assessment. Physics terms. Equations. What is a frame of reference? 5/19/14

PH2213 : Examples from Chapter 9 : Linear Momentum. Key Concepts Methods in this chapter give us tools for analyzing:

Lab: Lunar Lander C O N C E P T U A L P H Y S I C S : U N I T 3

HSC PHYSICS ONLINE B F BA. repulsion between two negatively charged objects. attraction between a negative charge and a positive charge

VISUAL PHYSICS ONLINE DYNAMICS TYPES OF FORCES FRICTION

Elementary Physics October 8, 2007

Version A (01) Question. Points

Chapter 5 Newton s Laws of Motion. Copyright 2010 Pearson Education, Inc.

Assignment 4: Rigid Body Dynamics

Preliminary Work. [ Answer: 56 Ns; 56 Ns ]

Extra credit assignment #4 It can be handed in up until one class before Test 4 (check your course outline). It will NOT be accepted after that.

PHYS 121: Work, Energy, Momentum, and Conservation Laws, Systems, and Center of Mass Review Sheet

Unit 5: Momentum. Vocabulary: momentum, impulse, center of mass, conservation of momentum, elastic collision, inelastic collision.

Momentum and Impulse Practice Multiple Choice

CHAPTER 2: FORCES AND MOTION

Figure 1: Doing work on a block by pushing it across the floor.

Recap: Energy Accounting

Complex Numbers and Quaternions for Calc III

Physics Momentum Problems. Science and Mathematics Education Research Group

Chapter 2 Math Fundamentals

MOMENTUM, IMPULSE & MOMENTS

Conservation of Momentum. Last modified: 08/05/2018

PH105 Exam 1 Solution

Physics 101: Lecture 08. Common Incorrect Forces (Spooky Rules!) Items below are NOT forces Acceleration: F Net = ma Centripetal Acceleration

Gravity Pre-Lab 1. Why do you need an inclined plane to measure the effects due to gravity?

PHYS 154 Practice Test 3 Spring 2018

Physics 11 Chapter 10: Energy and Work

1. The first thing you need to find is the mass of piece three. In order to find it you need to realize that the masses of the three pieces must be

Chapter 4 Dynamics: Newton s Laws of Motion

NowGeen. Ridley Shetler, Sarah Martin and Chad Dorais. Engineering 151 s final project is to create a functioning Rube-Goldberg device that will

Physics 103, Practice Midterm Exam 2

(A) 0 (B) mv (C) 2mv (D) 2mv sin θ (E) 2mv cos θ

(k = force constant of the spring)

An astronaut of mass 80 kg pushes away from a space Both!p x

Momentum and Collisions

PHY131H1F - Class 15. Today, we are finishing Chapter 9 on Momentum: Impulse and Momentum. Energy in Collisions. Totally Inelastic Collisions

Created by T. Madas COLLISIONS. Created by T. Madas

AP PHYSICS 1 UNIT 4 / FINAL 1 PRACTICE TEST

Momentum, Work and Energy Review

PHY2048 Physics with Calculus I

Exam 2: Equation Summary

(Refer Slide Time: 0:16)

P211 Spring 2004 Form A

4) Vector = and vector = What is vector = +? A) B) C) D) E)

Comprehensive Exam Session III Classical Mechanics Physics Department- Proctor: Dr. Jack Straton (Sun. Jan 11 th, 2015) (3 hours long 1:00 to 4:00 PM)

VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANKULATHUR DEPARTMENT OF MECHANICAL ENGINEERING

PHYSICS. Chapter 5 Lecture FOR SCIENTISTS AND ENGINEERS A STRATEGIC APPROACH 4/E RANDALL D. KNIGHT Pearson Education, Inc.

Chapter 3 Acceleration

Academic Physics! Work and Momentum Summary! Name

Center of Mass & Linear Momentum

*************************************************************************

Newton s Laws of Motion. Chapter 4

PRACTICE TEST for Midterm Exam

Chapter 3 Acceleration

Impulse and Momentum

Physics 116A, Section 2, Second Exam A, February 26, Name (Please print)

Physics 116A, Section 2, Second Exam Version B, February 26, Name (Please print)

Solving Momentum Problems

Game Physics: Basic Concepts

Contents. Objectives Work II Potential Energy Energy Conservation Potential Wells Bar Graphs Recap. Contents

Robotics. Dynamics. University of Stuttgart Winter 2018/19

Engineering Mechanics I. Phongsaen PITAKWATCHARA

Special Theory of Relativity Prof. Shiva Prasad Department of Physics Indian Institute of Technology, Bombay. Lecture - 15 Momentum Energy Four Vector

PHYSICS I RESOURCE SHEET

Work. Work is the measure of energy transferred. Energy: the capacity to do work. W = F X d

EXAM 3 MECHANICS 40% of the final grade

2. Mass, Force and Acceleration

GAME PHYSICS (INFOMGP) FINAL EXAM

MEI Mechanics 2. A Model for Friction. Section 1: Friction

PHYSICS 107. Lecture 5 Newton s Laws of Motion

SRI LANKAN PHYSICS OLYMPIAD COMPETITION 2006

3 Using Newton s Laws

Robotics. Dynamics. Marc Toussaint U Stuttgart

SOLUTION. will destroy the integrity of the work and Anis not permitted

Physics Momentum. CQ8. A train and a bird are both moving with the same velocity of 50 m/s. Compare their momenta.

7.1 Momentum. Can you have inertia sitting in your seat? Do you have momentum (relative to the room) sitting in your seat? What is momentum?

Physics 8 Wednesday, October 19, Troublesome questions for HW4 (5 or more people got 0 or 1 points on them): 1, 14, 15, 16, 17, 18, 19. Yikes!

3/10/2019. What Is a Force? What Is a Force? Tactics: Drawing Force Vectors

Exam #2, Chapters 5-7 PHYS 101-4M MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Physics Department. Experiment 03: Work and Energy

Study Questions/Problems Week 6

Physics 12 Final Exam Review Booklet # 1

Name: Class: Date: so sliding friction is better so sliding friction is better d. µ k

for any object. Note that we use letter, m g, meaning gravitational

Chapter 3 Acceleration

Transcription:

PSE Game Physics Session (3) Springs, Ropes, Linear Momentum and Rotations Atanas Atanasov, Philipp Neumann, Martin Schreiber 20.05.2011 Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 1

Outline Springs and ropes Overview Springs Ropes Linear momentum Overview Object properties Conservation laws Updated velocities Getting more insight, no formulas Why to use the inverse of mass? Momentum in 3D Rotations Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 2

Outline Springs and ropes Overview Springs Ropes Linear momentum Overview Object properties Conservation laws Updated velocities Getting more insight, no formulas Why to use the inverse of mass? Momentum in 3D Rotations Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 3

Springs and Ropes Springs and ropes are so called constraints since they force different objects to behave in a specific way. Other constraints are e. g. a hinge or a wheel attached to a car Springs and ropes are frequently used in games: Ropes and springs to drag & drop something Building bridges out of ropes Setting up a 3rd-person camera with damped spring Connecting 2 objects... For this worksheet, we assume a few simplifications: The spring is attached to the mass center of the object Spring/Rope collisions are not considered Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 4

Springs (1/2) Object1 Object2 Figure: Spring Create a force acting on both involved objects Force depends on the distance of the spring anchors Hook s law gives us the force acting on each object: F = k d F: Applied force, k: Spring coefficient, d: Distance between both objects Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 5

Springs (2/2) How to implement this force into our physics engine? This force can be implemented via a soft constraint: Since we know the time-step size, we are able to compute the acceleration exceeded by the spring s force for each object within this time-step (use an explicit euler step). Then the change of acceleration can be simply added to the acceleration accumulator during each time-step. The direction is given by the line between the anchor points of both objects Question: Are there problems with large time-steps and large spring coefficients? Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 6

Ropes (1/2) Object1 Object2 Figure: Top image: rope without exceeding its maximum length, Bottom image: Colliding rope We only consider ropes without rope collisions!!! After finishing all worksheets, you ll be able to simulate this as well :-) Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 7

Ropes (2/2) Object1 Object2 max length interpenetration depth Figure: Colliding details Imagine 2 objects with increasing distance. Once the anchor points of the ropes at the objects exceed a specific rope length an impulse acts onto both attached objects This is similar to applying an impulse during collision handling hard constraint Create a simple collision dataset Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 8

Outline Springs and ropes Overview Springs Ropes Linear momentum Overview Object properties Conservation laws Updated velocities Getting more insight, no formulas Why to use the inverse of mass? Momentum in 3D Rotations Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 9

Linear momentum Once there is a collision, several things have to be done: Resolving the interpenetration (finished during last session) The velocity of at least one object has to be modified according to its current states So far, we only consider elastic collisions! Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 10

Basics Object 1 V 1 = 1 V 2 = -1 Object 2 m 1 = 2 m 2 = 1 Figure: 2 colliding spheres Relevant object properties for linear momentum in 1D: mass of objects: m 1, m 2 velocity of object before collision: v 1, v 2 velocity of object after collision: v 1, v 2 Closing velocity: v c = v 1 v 2 What s the separating velocity for each object? Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 11

We start with a few basic conservation laws: Energy conservation for elastic collisions: 1 2 m 1v1 2 + 1 2 m 2v2 2 = 1 2 m 1v 2 1 + 1 2 m 2v 2 2 Conservation of momentum: m 1 v 1 + m 2 v 2 = m 1 v 1 + m 2 v 2 Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 12

We start by rewriting the energy conservation law to m 1 (v 2 1 v 2 1 ) = m 2 (v 2 2 v 2 2 ) and avoid an expression of the velocity with a square exponent: m 1 (v 1 v 1) (v 1 + v }{{} 1) = m 2 (v 2 v 2)(v 2 + v 2) A By rewriting the equation for the conservation of momentum to m 1 (v 1 v 1) = m 2 (v 2 v 2) we can replace (A) by the right side of the upper equation: m 2 (v 2 v 2)(v 1 + v 1) = m 2 (v 2 v 2)(v 2 + v 2) Finally, we get the first result: v 1 + v 1 = v 2 + v 2 or v 1 v 2 = v 2 v 1 with v 1 v 2 = v s as the separating velocity pointing into the opposite direction of the closing velocity (both objects separate) Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 13

Updated Velocities Using the relation v 1 v 2 = v 2 v 1 of the previous slide, we can rearrange it to v 2 = v 1 v 2 + v 1 By putting this equation in the momentum equation, we get m 1 (v 1 v 1) = m 2 (v 2 (v 1 v 2 +v 1)) = m 2 v 2 +m 2 v 1 m 2 v 2 +m 2 v 1 Extension by 0 {}}{ m 1 v 1 + m 2 v 1 = 2m 2 v 2 m 2 v 1 + m 1 v 1 +m 2 v 1 m 2 v 1 (m 1 + m 2 )v 1 = 2(m 2 v 2 m 2 v 1 ) + (m 1 + m 2 )v 1 By dividing the equation by (m 1 + m 2 ), the velocity of object 1 after collision is given by v 1 = 2 m 2(v 2 v 1 ) m 1 + m 2 + v 1 Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 14

Normally, collisions are not completely elastic. The coefficient of restitution C r is used to represent the respective deviation depending on the closing and separating velocity: C r = v 2 v 1 v 1 v 2 = v s v c By replacing (v 1 v 2 ) with the closing velocity v c and including the coefficient of restitution, the velocity of object 1 after collision is given by m 2 v 1 = 2 v c C r + v 1 m 1 + m 2 Similarly, the velocity of object 2 after the collision is given by m 1 v 2 = 2 v c C r + v 2 m 1 + m 2 Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 15

Getting more insight, no formulas Understanding the formulas is one of the most important things. Therefore we have a look at the most important parts: v 2 }{{} new velocity = 2 }{{} 2 m 1 m 1 + m }{{ 2 } New velocity: Simply the new velocity v c }{{} closing velocity mass fraction C r + v 2 }{{} old velocity Impulse: The change of velocity is computed via an impulse which becomes apparent when separating into mass and velocity Mass fraction: The fraction accounts for the change of velocity depending on the fraction m object /m total 2: Imagine an object 2 with mass of 1 hitting another object with infinite mass. Then object 1 is not moving at all but object 2 has to reverse its velocity by adding n-times the closing velocity. To modify the velocity of object 2 to aim into the inversed direction, the closing velocity is taken twice. Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 16

Using inverse mass... Computing v 2 directly, we get problems when the masses of the objects are close to infinity, i.e. very huge. Assuming, that m 1 =, we get v 2 = 2 v c + v 2 + m }{{ 2 }!!! Without further checks, we run into severe problems due to the limited accuracy of the computer numbers. Therefore we are working with the inverse of mass: 1 m 1 2 ( 1 + 1 m 1 1 m 1 2 ) = ( 1 m 1 1 1 m 1 2 + 1 (m 1 1 m 1 2 ) m 1 2 )(m 1 1 m 1 1 1 2 ) = m m 1 1 + m 1 2 Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 17

Momentum in 3D closing velocity -n v 1 α closing velocity v 1 collision normal n Ground Figure: Collision involving the collision normal For 3D, we have to take the collision normal into account. Only the velocity component parallel to the collision normal may be involved in computing the new velocity (no friction so far!) Thus v is computed by using only the fraction of the velocity in direction of the collision normal. Using the dot product we can compute this fraction by: v = n c v Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 18

Outline Springs and ropes Overview Springs Ropes Linear momentum Overview Object properties Conservation laws Updated velocities Getting more insight, no formulas Why to use the inverse of mass? Momentum in 3D Rotations Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 19

Rotations Different approaches to describe rotations Euler angles Quaternions... Rotation matrix in 2D: ( ) R 2D cos θ sin θ (θ) = sin θ cos θ ( ) 1 Example: Rotate vector v = by 90 degrees (= 0 π 2 ) v new = R 2D ( π ( ) ( ) ( 0 1 1 0 2 ) v = = 1 0 0 1 ) (1) (2) Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 20

It s not that easy... Handling rotations sounds straight-forward, but definitely isn t! Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 21

Euler Angles From 2D rotation: 1 rotation axis therefore, we use one type of rotation matrix R 2D 3D: 3 possible rotation axes (x,y,z) use three rotations to describe any rotation in space Euler angles: Describe rotated position by angles between this position and reference position z y x Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 22

Euler Angles: Problems Different conventions/ approaches Example: zxy-convention 1. Rotation about z-axis 2. Rotation about x-axis 3. Rotation about y-axis 3 degrees of freedom z y rotate 180 about z, rotate 0 about x, rotate 0 about y x rotate 0 about z, rotate 180 about x, rotate 180 about y Rotational description not unique Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 23

Euler Angles: Problems - Gimbal Lock (1) Excerpt from the NASA logs and commentary (taken from Visualizing Quaternions, A.J. Hanson,2006): After Stafford s camera failed, he and Cernan had little to do except look at the scenery until time to dump the descent stage. Stafford had the vehicle in the right attitude 10 minutes early. Cernan asked, You ready? Then he suddenly exclaimed, Son of a bitch! Snoopy seemed to be throwing a fit, lurching wildly about. He later said it was like flying an Immelmann turn in an aircraft, a combination of pitch and yaw. Stafford yelled that they were in gimbal lock that the engine had swiveled over to a stop and stuck- and they almost were. He called out for Cernan to thrust forward. Stafford then hit the switch to get rid of the descent stage and realized they were 30 degrees off from their previous attitude. The lunar module continued its crazy gyrations across the lunar sky, and a warning light indicated that the inertial measuring unit really was about to reach its limits and go into gimbal lock. Stafford then took over in manual control, made a big pitch maneuver, and started working the attitude control switches. Snoopy finally calmed down. Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 24

Euler Angles: Problems - Gimbal Lock (2) Gimbal Lock: Loss of one degree of freedom in rotations z y rotate 0 about z, rotate 0 about x, rotate 90 about y x Example: x- and z-axis become parallel Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 25

Quaternions: Basics Describe a rotation θ around an arbitrary axis (x, y, z) in space Advantage: 3+1 degrees of freedom Solves the Gimbal Lock-Problem Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 26

Review: Complex numbers C Field (German: Körper ), isomorph to R 2, ( x i.e. we can write a complex number x + iy as vector y ) Addition: ( ) ( ) ( ) x1 x2 x1 + x + = 2 y 1 y 2 y 1 + y 2 Multiplication: ( ) ( ) ( ) x1 x2 x1 x = 2 y 1 y 2 y 1 y 2 x 1 y 2 + x 2 y 1 Rotation in this context: ( ) ( ) cos θ x = sin θ y ( cos θx sin θy sin θx + cos θy ) ( R 2D x y ) Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 27

Quaternions (1) Skew field H (German: Schiefkörper ) (field, but no commutativity in multiplication, i.e. q 1 q 2 q 2 q 1 ) Addition: Just like regular vector addition (compare complex number addition) Multiplication: w 1 i 1 j 1 k 1 w 2 i 2 j 2 k 2 = w 1 w 2 (i 1 i 2 + j 1 j 2 + k 1 k 2 ) w 1 i 2 + w 2 i 1 + j 1 k 2 k 1 j 2 w 1 j 2 + w 2 j 1 + k 1 i 2 i 1 k 2 w 1 k 2 + w 2 k 1 + i 1 j 2 j 1 i 2 Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 28

Quaternions (2) Choose a vector n R 3 with n = 1 (rotation axis) and consider two quaternions q 1, q 2 of the form: ( ) ( ) w1 w2 q 1 =, q a 1 n 2 = a 2 n Multiplication yields: q 1 q 2 = ( w1 w 2 a 1 a 2 (w 1 a 2 + w 2 a 1 ) n Compare this to multiplication of complex numbers! ( ) ( ) ( ) x1 x2 x1 x = 2 y 1 y 2 y 1 y 2 x 1 y 2 + x 2 y 1 ) Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 29

Quaternions (3) Quaternions: Generalisation of complex numbers: w + ix + jy + kz with complex units i, j, k Rules for imaginary units: i 2 = j 2 = k 2 = 1 ijk = 1 Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 30

Quaternions: Convertions Given rotation axis (x, y, z) and angle θ w cos θ 2 q := i j = x sin θ 2 y sin θ R R3 2 k z sin θ 2 Convert quaternion back to general rotation matrix R via R = 1 2(j 2 + k 2 ) 2(ij + kw) 2(ik jw) 2(ij kw) 1 2(i 2 + k 2 ) 2(jk + iw) 2(ik + jw) 2(jk iw) 1 2(i 2 + j 2 ) Session (3)Springs, Ropes, Linear Momentum and Rotations, 20.05.2011 31