Physics for Games Programmers Reframing the Problem Squirrel Eiserloh Technical Director MumboJumbo Games

Slides:



Advertisements
Similar presentations
1 Radio Maria World. 2 Postazioni Transmitter locations.
Advertisements

The Fall Messier Marathon Guide
Physics for Games Programmers Tutorial Motion and Collision – It’s All Relative Squirrel Eiserloh Lead Programmer Ritual Entertainment.
Números.
Trend for Precision Soil Testing % Zone or Grid Samples Tested compared to Total Samples.
Trend for Precision Soil Testing % Zone or Grid Samples Tested compared to Total Samples.
AGVISE Laboratories %Zone or Grid Samples – Northwood laboratory
Trend for Precision Soil Testing % Zone or Grid Samples Tested compared to Total Samples.
SKELETAL QUIZ 3.
PDAs Accept Context-Free Languages
/ /17 32/ / /
Reflection nurulquran.com.
EuroCondens SGB E.
Worksheets.
& dding ubtracting ractions.
Physics for Games Programmers Problem Overview Squirrel Eiserloh Technical Director Ritual Entertainment
1 Physics for Games Programmers Problem Overview Squirrel Eiserloh Technical Director MumboJumbo Games
Addition and Subtraction Equations
By John E. Hopcroft, Rajeev Motwani and Jeffrey D. Ullman
1 When you see… Find the zeros You think…. 2 To find the zeros...
Western Public Lands Grazing: The Real Costs Explore, enjoy and protect the planet Forest Guardians Jonathan Proctor.
Add Governors Discretionary (1G) Grants Chapter 6.
CALENDAR.
CHAPTER 18 The Ankle and Lower Leg
Summative Math Test Algebra (28%) Geometry (29%)
Introduction to Turing Machines
ASCII stands for American Standard Code for Information Interchange
The 5S numbers game..
突破信息检索壁垒 -SciFinder Scholar 介绍
A Fractional Order (Proportional and Derivative) Motion Controller Design for A Class of Second-order Systems Center for Self-Organizing Intelligent.
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
The basics for simulations
Factoring Quadratics — ax² + bx + c Topic
© 2010 Concept Systems, Inc.1 Concept Mapping Methodology: An Example.
PP Test Review Sections 6-1 to 6-6
MM4A6c: Apply the law of sines and the law of cosines.
Figure 3–1 Standard logic symbols for the inverter (ANSI/IEEE Std
TCCI Barometer March “Establishing a reliable tool for monitoring the financial, business and social activity in the Prefecture of Thessaloniki”
1 Prediction of electrical energy by photovoltaic devices in urban situations By. R.C. Ott July 2011.
Dynamic Access Control the file server, reimagined Presented by Mark on twitter 1 contents copyright 2013 Mark Minasi.
TCCI Barometer March “Establishing a reliable tool for monitoring the financial, business and social activity in the Prefecture of Thessaloniki”
Progressive Aerobic Cardiovascular Endurance Run
2.5 Using Linear Models   Month Temp º F 70 º F 75 º F 78 º F.
Visual Highway Data Select a highway below... NORTH SOUTH Salisbury Southern Maryland Eastern Shore.
Slide P- 1. Chapter P Prerequisites P.1 Real Numbers.
MaK_Full ahead loaded 1 Alarm Page Directory (F11)
TCCI Barometer September “Establishing a reliable tool for monitoring the financial, business and social activity in the Prefecture of Thessaloniki”
When you see… Find the zeros You think….
2011 WINNISQUAM COMMUNITY SURVEY YOUTH RISK BEHAVIOR GRADES 9-12 STUDENTS=1021.
Before Between After.
2011 FRANKLIN COMMUNITY SURVEY YOUTH RISK BEHAVIOR GRADES 9-12 STUDENTS=332.
ST/PRM3-EU | | © Robert Bosch GmbH reserves all rights even in the event of industrial property rights. We reserve all rights of disposal such as copying.
Subtraction: Adding UP
Numeracy Resources for KS2
1 Non Deterministic Automata. 2 Alphabet = Nondeterministic Finite Accepter (NFA)
Static Equilibrium; Elasticity and Fracture
ANALYTICAL GEOMETRY ONE MARK QUESTIONS PREPARED BY:
Resistência dos Materiais, 5ª ed.
Lial/Hungerford/Holcomb/Mullins: Mathematics with Applications 11e Finite Mathematics with Applications 11e Copyright ©2015 Pearson Education, Inc. All.
WARNING This CD is protected by Copyright Laws. FOR HOME USE ONLY. Unauthorised copying, adaptation, rental, lending, distribution, extraction, charging.
UNDERSTANDING THE ISSUES. 22 HILLSBOROUGH IS A REALLY BIG COUNTY.
A Data Warehouse Mining Tool Stephen Turner Chris Frala
1 Dr. Scott Schaefer Least Squares Curves, Rational Representations, Splines and Continuity.
Chart Deception Main Source: How to Lie with Charts, by Gerald E. Jones Dr. Michael R. Hyman, NMSU.
1 Non Deterministic Automata. 2 Alphabet = Nondeterministic Finite Accepter (NFA)
Introduction Embedded Universal Tools and Online Features 2.
What impact does the address have on the tribe?
Schutzvermerk nach DIN 34 beachten 05/04/15 Seite 1 Training EPAM and CANopen Basic Solution: Password * * Level 1 Level 2 * Level 3 Password2 IP-Adr.
Presentation transcript:

Physics for Games Programmers Reframing the Problem Squirrel Eiserloh Technical Director MumboJumbo Games

Physics for Games Programmers Reframing the Problem a.k.a. Its All Relative Squirrel Eiserloh Technical Director MumboJumbo Games

3 Overview Tunneling Movement Bounds Swept Shapes Einstein Says... Minkowski Says... Rotation

Tunneling (Sucks)

5 Tunneling Question #1: Do objects A and B overlap? Plenty of reference material to help solve this, but......this is often the wrong question to ask (begs tunneling).

6 Tunneling

7

8

9

10 Tunneling (contd) Tunneling is very, very bad – this is not a mundane detail Things falling through world Bullets passing through people or walls Players getting places they shouldnt Players missing a trigger boundary Tunneling is a false negative Okay, so tunneling really sucks. What can we do about it?

Movement Bounds

12 Movement Bounds Disc / Sphere

13 Movement Bounds Disc / Sphere AABB (Axis-Aligned Bounding Box)

14 Movement Bounds Disc / Sphere AABB (Axis-Aligned Bounding Box) OBB (Oriented Bounding Box)

15 Movement Bounds Question #2: Could A and B have collided during the frame? Better than Question #1 (solves tunneling!), but...

16 Movement Bounds Question #2: Could A and B have collided during the frame? Better than Question #1 (solves tunneling!), but......even if the answer is yes, we still dont know for sure (false positive).

17 Movement Bounds Conclusion Good: They prevent tunneling! (i.e. no false negatives) Bad: They dont actually tell us whether A and B collided (still have false positives). Good: They can be used as a cheap, effective early rejection test.

Swept Shapes

19 Swept Shapes Swept disc / sphere (n-sphere): capsule

20 Swept Shapes Swept disc / sphere (n-sphere): capsule Swept AABB: convex polytope (polygon in 2d, polyhedron in 3d)

21 Swept Shapes Swept disc / sphere (n-sphere): capsule Swept AABB: convex polytope (polygon in 2d, polyhedron in 3d) Swept triangle / tetrahedron (simplex): convex polytope

22 Swept Shapes Swept disc / sphere (n-sphere): capsule Swept AABB: convex polytope (polygon in 2d, polyhedron in 3d) Swept triangle / tetrahedron (simplex): convex polytope Swept polytope: convex polytope

23 Swept Shapes (contd) Like movement bounds, only with a perfect fit!

24 Swept Shapes (contd) Like movement bounds, only with a perfect fit! Still no false negatives (tunneling).

25 Swept Shapes (contd) Like movement bounds, only with a perfect fit! Still no false negatives (tunneling). Finally, no false positives, either!

26 Swept Shapes (contd) Like movement bounds, only with a perfect fit! Still no false negatives (tunneling). Finally, no false positives, either! No, wait, nevermind. Still have em. Rats.

27 Swept Shapes (contd) Like movement bounds, only with a perfect fit! Still no false negatives (tunneling). Finally, no false positives, either! No, wait, nevermind. Still have em. Rats.

28 Swept Shapes (contd) Like movement bounds, only with a perfect fit! Still no false negatives (tunneling). Finally, no false positives, either! No, wait, nevermind. Still have em. Rats.

29 Swept Shapes (contd) Conclusion Suck? Can be used as early rejection test, but......movement bounds are better for that. If youre not too picky......they DO solve a large number of nasty problems (especially tunneling)...and can serve as a poor mans continuous collision detection for a basic engine.

30

31 Einstein Says... Coordinate systems are relative

Relative Coordinate Systems

33 Relative Coordinate Systems World coordinates

34 Relative Coordinate Systems World coordinates As local coordinates

35 Relative Coordinate Systems World coordinates As local coordinates Bs local coordinates

36 Relative Coordinate Systems World coordinates As local coordinates Bs local coordinates Many others (e.g. origin at point of impact)

37 Relative Coordinate Systems (contd) Ball vs. world...

38 Relative Coordinate Systems (contd) Ball vs. world... in world coordinates

39 Relative Coordinate Systems (contd) Ball vs. world... in world coordinates x component y component

40 Relative Coordinate Systems (contd) Ball vs. world... in world coordinates x component y component in impact coordinates

41 Relative Coordinate Systems (contd) Ball vs. world... in world coordinates x component y component in impact coordinates parallel component perpendicular component

42 Relative Coordinate Systems (contd) Ball vs. world... in world coordinates x component y component in impact coordinates parallel component perpendicular component Change in motion happens along the perpendicular axis

43 Relative Coordinate Systems (contd) Ball vs. ball...

44 Relative Coordinate Systems (contd) Ball vs. ball... in world coordinates

45 Relative Coordinate Systems (contd) Ball vs. ball... in world coordinates x component y component

46 Relative Coordinate Systems (contd) Ball vs. ball... in world coordinates x component y component in impact coordinates

47 Relative Coordinate Systems (contd) Ball vs. ball... in world coordinates x component y component in impact coordinates parallel component perpendicular component Energy is exchanged along the perpendicular axis

48 Relative Coordinate Systems (contd) x 2 + y 2 = r 2 x 2 - 2xh + h 2 + y 2 - 2yk + k 2 = r 2 Also, math is often nicer at the origin.

49 Einstein Says... Coordinate systems are relative Motion is relative

Relative Motion

51 Relative Motion "Frames of Reference" World frame

52 Relative Motion "Frames of Reference" World frame A's frame

53 Relative Motion "Frames of Reference" World frame A's frame B's frame

54 Relative Motion "Frames of Reference" World frame A's frame B's frame Inertial frame

55 Relative Motion (contd) A Rule of Relativistic Collision Detection: It is always possible to reduce a collision check between two moving objects to a collision check between a moving object and a stationary object (by reframing)

56 (Does Not Suck)

Relative Collision Bodies

58 Relative Collision Bodies Collision check equivalencies (disc)

59 Relative Collision Bodies Collision check equivalencies (disc)...AABB

60 Relative Collision Bodies Collision check equivalencies (disc)...AABB Can even reduce one body to a singularity

61 Relative Collision Bodies Collision check equivalencies (disc)...AABB Can even reduce one body to a singularity Tracing or Rubbing collision bodies together

62 Relative Collision Bodies Collision check equivalencies (disc)...AABB Can even reduce one body to a singularity Tracing or Rubbing collision bodies together Spirograph-out the reduced bodys origin

63 Relative Collision Bodies Collision check equivalencies (disc)...AABB Can even reduce one body to a singularity Tracing or Rubbing collision bodies together Spirograph-out the reduced bodys origin

64 Relative Collision Bodies Collision check equivalencies (disc)...AABB Can even reduce one body to a singularity Tracing or Rubbing collision bodies together Spirograph-out the reduced bodys origin

65 Relative Collision Bodies Collision check equivalencies (disc)...AABB Can even reduce one body to a singularity Tracing or Rubbing collision bodies together Spirograph-out the reduced bodys origin

66 Relative Collision Bodies Collision check equivalencies (disc)...AABB Can even reduce one body to a singularity Tracing or Rubbing collision bodies together Spirograph-out the reduced bodys origin

67 Relative Collision Bodies Collision check equivalencies (disc)...AABB Can even reduce one body to a singularity Tracing or Rubbing collision bodies together Spirograph-out the reduced bodys origin

68 Relative Collision Bodies Collision check equivalencies (disc)...AABB Can even reduce one body to a singularity Tracing or Rubbing collision bodies together Spirograph-out the reduced bodys origin

69 Relative Collision Bodies Collision check equivalencies (disc)...AABB Can even reduce one body to a singularity Tracing or Rubbing collision bodies together Spirograph-out the reduced bodys origin

70 Relative Collision Bodies (contd) Disc + disc

71 Relative Collision Bodies (contd) Disc + disc AABB + AABB

72 Relative Collision Bodies (contd) Disc + disc AABB + AABB Triangle + AABB

73 Relative Collision Bodies (contd) Disc + disc AABB + AABB Triangle + AABB AABB + triangle

74 Relative Collision Bodies (contd) Disc + disc AABB + AABB Triangle + AABB AABB + triangle Polytope + polytope

75 Relative Collision Bodies (contd) Disc + disc AABB + AABB Triangle + AABB AABB + triangle Polytope + polytope Polytope + disc

76 Relative Collision Bodies (contd) Things start to get messy when combining bodies explicitly / manually. (Especially in 3d.) General solution?

Minkowski Arithmetic

78 Minkowski Sums The Minkowski Sum (A+B) of A and B is the result of adding every point in A to every point in B.

79 Minkowski Differences The Minkowski Difference (A-B) of A and B is the result of subtracting every point in B from every point in A (or A + -B)

80 Minkowski Differences The Minkowski Difference (A-B) of A and B is the result of subtracting every point in B from every point in A Resulting shape is different from A+B.

81 Minkowski Differences (contd) Minkowski Differences are not commutative: A-B != B-A Minkowski Difference of convex objects is convex (since A-B = A+ -B)

82 Minkowski Differences (contd) Minkowski Differences are not commutative: A-B != B-A Minkowski Difference of convex objects is convex (since A-B = A+ -B) Minkowski Difference produces the same shape as Spirograph

83 Minkowski Differences (contd) If the singularity is outside the combined body, A and B do not overlap.

84 Minkowski Differences (contd) If the singularity is outside the combined body, A and B do not overlap. If the singularity is inside the combined body (A-B), then A and B overlap.

85 Minkowski Differences (contd) In world space, A-B is near the origin

86 Minkowski Differences (contd) A origin vs. B origin -B origin ___ (A-B) origin vs. 0

87 Minkowski Differences (contd) Since the singularity point is always at the origin (B-B), we can say... If (A-B) does not contain the origin, A and B do not overlap.

88 Minkowski Differences (contd) If (A-B) contains the origin, A and B overlap. In other words, we reduce A vs. B to: combined body (A-B) vs. point (B-B, or origin)

89 Minkowski Differences (contd) If A and B are in the same coordinate system, the comparison between A-B and the origin is said to happen in configuration space...in which case A-B is said to be a configuration space obstacle (CSO)

90 Minkowski Differences (contd) Translations in A or B simply translate the CSO

91 Minkowski Differences (contd) Rotations in A or B mutate the CSO

92 (Does Not Suck)

Relative Everything

94 Relative Everything Lets combine: Relative Coordinate Systems Relative Motion Relative Collision Bodies

95 Relative Everything (contd) A vs. B in world frame

96 Relative Everything (contd) A vs. B in world frame A is CSO, B is point

97 Relative Everything (contd) A vs. B in world frame A is CSO, B is point A is moving CSO, B is still point

98 Relative Everything (contd) A vs. B in world frame A is CSO, B is point A is moving CSO, B is still point A is still CSO, B is moving point This is the one we want!

99 Relative Everything (contd) Question #3: Did A and B collide during the frame? Yes! We can now get an exact answer. No false negatives, no false positives! However, we still dont know WHEN they collided...

100 Relative Everything (contd) Why does the exact collision time matter? Outcomes can be different Order of events (e.g. multiple collisions) is relevant Collision response is easier when you can reconstruct the exact moment of impact

101 Relative Everything (contd) Question #4: When, during the frame, did A and B collide? The time at which the ray intersects the CSO is the time at which the collision occurred. Finally, the right question - and we have a complete answer!

102 Relative Everything (contd) The Minkowski Difference (A-B) / CSO can also be thought of as the set of all translations [from the origin] that would cause a collision. A.K.A. the set of inadmissible translations.

Quality vs. Quantity or You Get What You Pay For

104 Quality vs. Quantity The more you ask, the more you pay. Question #1: Do A and B overlap? Question #2: Could A and B have collided during the frame? Question #3: Did A and B collide during the frame? Question #4: When, during the frame, did A and B collide?

Rotations (Suck)

106 Rotations Continuous rotational collision detection sucks Rotational tunneling alone is problematic

107 Rotations Continuous rotational collision detection sucks Rotational tunneling alone is problematic Methods weve discussed here often dont work on rotations, or their rotational analogue is quite complex

108 Rotations (contd) However: Rotational tunneling is usually not as jarring as translational tunneling Rotational speed limits are actually feasible Can do linear approximations of swept rotations Can use bounding shapes to contain pre- and post-rotated positions This is something that many engines never solve robustly

Summary

110 Summary Have to worry about false negatives (tunneling!) as well as false positives. Knowing when a collision event took place can be very important (especially when resolving it). Sometimes a problem (and math) looks easier when we look at it from a different viewpoint. Can combine bodies in cheaty ways to simplify things even further.

111 Summary (contd) Einstein and Minkowski are cool. Rotations suck. Doing real-time collision detection doesnt have to be hard. Or expensive. Or confusing.

112 Questions? Feel free to reach me by at: