1 / 112

Physics for Games Programmers Reframing the Problem

Physics for Games Programmers Reframing the Problem. Squirrel Eiserloh Technical Director MumboJumbo Games squirrel@eiserloh.net www.algds.org. Physics for Games Programmers Reframing the Problem a.k.a. “It’s All Relative”.

mchu
Download Presentation

Physics for Games Programmers Reframing the Problem

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. Physics for Games Programmers Reframing the Problem Squirrel EiserlohTechnical DirectorMumboJumbo Gamessquirrel@eiserloh.netwww.algds.org

  2. Physics for Games Programmers Reframing the Problema.k.a. “It’s All Relative” Squirrel EiserlohTechnical DirectorMumboJumbo Gamessquirrel@eiserloh.netwww.algds.org

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

  4. 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. Tunneling

  8. Tunneling

  9. Tunneling

  10. Tunneling (cont’d) • 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 shouldn’t • Players missing a trigger boundary • Tunneling is a false negative • Okay, so tunneling really sucks. What can we do about it?

  11. 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 don’t know for sure (false positive).

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

  18. Swept Shapes

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

  20. Swept Shapes • Swept disc / sphere (n-sphere): capsule • Swept AABB: convexpolytope (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: convexpolytope

  23. Swept Shapes (cont’d) • Like movement bounds, only with a perfect fit!

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

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

  26. Swept Shapes (cont’d) • 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 (cont’d) • 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 (cont’d) • 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 (cont’d) • Conclusion • Suck? • Can be used as early rejection test, but... • ...movement bounds are better for that. • If you’re not too picky... • ...they DO solve a large number of nasty problems (especially tunneling) • ...and can serve as a poor man’s continuous collision detection for a basic engine.

  30. Einstein Says... • Coordinate systems are relative

  31. Relative Coordinate Systems

  32. Relative Coordinate Systems • World coordinates

  33. Relative Coordinate Systems • World coordinates • A’s local coordinates

  34. Relative Coordinate Systems • World coordinates • A’s local coordinates • B’s local coordinates

  35. Relative Coordinate Systems • World coordinates • A’s local coordinates • B’s local coordinates • Many others (e.g. origin at point of impact)

  36. Relative Coordinate Systems (cont’d) • Ball vs. world...

  37. Relative Coordinate Systems (cont’d) • Ball vs. world... • in world coordinates

  38. Relative Coordinate Systems (cont’d) • Ball vs. world... • in world coordinates • x component • y component

  39. Relative Coordinate Systems (cont’d) • Ball vs. world... • in world coordinates • x component • y component • in impact coordinates

  40. Relative Coordinate Systems (cont’d) • Ball vs. world... • in world coordinates • x component • y component • in impact coordinates • parallel component • perpendicular component

  41. Relative Coordinate Systems (cont’d) • 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

  42. Relative Coordinate Systems (cont’d) • Ball vs. ball...

  43. Relative Coordinate Systems (cont’d) • Ball vs. ball... • in world coordinates

  44. Relative Coordinate Systems (cont’d) • Ball vs. ball... • in world coordinates • x component • y component

  45. Relative Coordinate Systems (cont’d) • Ball vs. ball... • in world coordinates • x component • y component • in impact coordinates

  46. Relative Coordinate Systems (cont’d) • Ball vs. ball... • in world coordinates • x component • y component • in impact coordinates • parallel component • perpendicular component • Energy is exchanged along the perpendicular axis

  47. Relative Coordinate Systems (cont’d) Also, math is often nicer at the origin. x2 - 2xh + h2 + y2 - 2yk + k2 = r2 x2 + y2 = r2

  48. Einstein Says... • Coordinate systems are relative • Motion is relative

  49. Relative Motion

More Related