You are previewing Physics for Game Developers, 2nd Edition.
O'Reilly logo
Physics for Game Developers, 2nd Edition

Book Description

If you want to enrich your game’s experience with physics-based realism, the expanded edition of this classic book details physics principles applicable to game development. You’ll learn about collisions, explosions, sound, projectiles, and other effects used in games on Wii, PlayStation, Xbox, smartphones, and tablets. You’ll also get a handle on how to take advantage of various sensors such as accelerometers and optical tracking devices.

Table of Contents

  1. Special Upgrade Offer
  2. Preface
    1. Who Is This Book For?
    2. What We Assume You Know
    3. Mechanics
    4. Digital Physics
    5. Arrangement of This Book
    6. Conventions Used in This Book
    7. Using Code Examples
    8. Safari® Books Online
    9. How to Contact Us
    10. Acknowledgments
  3. I. Fundamentals
    1. 1. Basic Concepts
      1. Newton’s Laws of Motion
      2. Units and Measures
      3. Coordinate System
      4. Vectors
      5. Derivatives and Integrals
      6. Mass, Center of Mass, and Moment of Inertia
      7. Newton’s Second Law of Motion
      8. Inertia Tensor
      9. Relativistic Time
    2. 2. Kinematics
      1. Velocity and Acceleration
      2. Constant Acceleration
      3. Nonconstant Acceleration
      4. 2D Particle Kinematics
      5. 3D Particle Kinematics
        1. X Components
        2. Y Components
        3. Z Components
        4. The Vectors
        5. Hitting the Target
      6. Kinematic Particle Explosion
      7. Rigid-Body Kinematics
      8. Local Coordinate Axes
      9. Angular Velocity and Acceleration
    3. 3. Force
      1. Forces
      2. Force Fields
      3. Friction
      4. Fluid Dynamic Drag
      5. Pressure
      6. Buoyancy
      7. Springs and Dampers
      8. Force and Torque
      9. Summary
    4. 4. Kinetics
      1. Particle Kinetics in 2D
      2. Particle Kinetics in 3D
        1. X Components
        2. Y Components
        3. Z Components
        4. Cannon Revised
      3. Rigid-Body Kinetics
    5. 5. Collisions
      1. Impulse-Momentum Principle
      2. Impact
      3. Linear and Angular Impulse
      4. Friction
    6. 6. Projectiles
      1. Simple Trajectories
      2. Drag
      3. Magnus Effect
      4. Variable Mass
  4. II. Rigid-Body Dynamics
    1. 7. Real-Time Simulations
      1. Integrating the Equations of Motion
      2. Euler’s Method
      3. Better Methods
      4. Summary
    2. 8. Particles
      1. Simple Particle Model
        1. Integrator
        2. Rendering
      2. The Basic Simulator
      3. Implementing External Forces
      4. Implementing Collisions
        1. Particle-to-Ground Collisions
        2. Particle-to-Obstacle Collisions
      5. Tuning
    3. 9. 2D Rigid-Body Simulator
      1. Model
        1. Transforming Coordinates
        2. Integrator
        3. Rendering
      2. The Basic Simulator
      3. Tuning
    4. 10. Implementing Collision Response
      1. Linear Collision Response
      2. Angular Effects
    5. 11. Rotation in 3D Rigid-Body Simulators
      1. Rotation Matrices
      2. Quaternions
        1. Quaternion Operations
          1. Magnitude
          2. Conjugate: The ~ operator
          3. QVRotate
          4. Quaternion multiplication: The * operator
          5. Vector multiplication: The * operator
          6. MakeQFromEulerAngles
          7. MakeEulerAnglesFromQ
      3. Quaternions in 3D Simulators
    6. 12. 3D Rigid-Body Simulator
      1. Model
      2. Integration
      3. Flight Controls
    7. 13. Connecting Objects
      1. Springs and Dampers
      2. Connecting Particles
        1. Rope
          1. Spring structure and variables
          2. Initialize the particles and springs
          3. Update the simulation
      3. Connecting Rigid Bodies
        1. Links
          1. Basic structures and variables
          2. Initialize
          3. Update
        2. Rotational Restraint
    8. 14. Physics Engines
      1. Building Your Own Physics Engine
        1. Physics Models
        2. Simulated Objects Manager
        3. Collision Detection
        4. Collision Response
        5. Force Effectors
        6. Numerical Integrator
  5. III. Physical Modeling
    1. 15. Aircraft
      1. Geometry
      2. Lift and Drag
      3. Other Forces
      4. Control
      5. Modeling
    2. 16. Ships and Boats
      1. Stability and Sinking
        1. Stability
        2. Sinking
      2. Ship Motions
        1. Heave
        2. Roll
        3. Pitch
        4. Coupled Motions
      3. Resistance and Propulsion
        1. General Resistance
          1. Planing craft
          2. Virtual mass
          3. Guidance speeds
        2. Propulsion
      4. Maneuverability
        1. Rudders and Thrust Vectoring
          1. Propeller walk
    3. 17. Cars and Hovercraft
      1. Cars
        1. Resistance
        2. Power
        3. Stopping Distance
        4. Steering
      2. Hovercraft
        1. How Hovercraft Work
        2. Resistance
        3. Steering
    4. 18. Guns and Explosions
      1. Projectile Motion
      2. Taking Aim
        1. Zeroing the Sights
          1. Bullet drop: Gravity and air resistance
          2. Wind
        2. Breathing and Body Position
      3. Recoil and Impact
      4. Explosions
        1. Particle Explosions
        2. Polygon Explosions
    5. 19. Sports
      1. Modeling a Golf Swing
        1. Solving the Golf Swing Equations
      2. Billiards
        1. Implementation
        2. Initialization
        3. Stepping the Simulation
        4. Calculating Forces
        5. Handling Collisions
  6. IV. Digital Physics
    1. 20. Touch Screens
      1. Types of Touch Screens
        1. Resistive
        2. Capacitive
        3. Infrared and Optical Imaging
        4. Exotic: Dispersive Signal and Surface Acoustic Wave
      2. Step-by-Step Physics
        1. Resistive Touch Screens
          1. One-dimensional resistive touch sensor
          2. Four-wire resistive touch screen
        2. Capacitive Touch Screens
          1. Self-capacitance
          2. Mutual capacitance
      3. Example Program
        1. Multitouch
      4. Other Considerations
        1. Haptic Feedback
        2. Modeling Touch Screens in Games
        3. Difference from Mouse-Based Input
        4. Custom Gestures
    2. 21. Accelerometers
      1. Accelerometer Theory
        1. MEMS Accelerometers
        2. Common Accelerometer Specifications
        3. Data Clipping
      2. Sensing Orientation
      3. Sensing Tilt
        1. Using Tilt to Control a Sprite
        2. Two Degrees of Freedom
    3. 22. Gaming from One Place to Another
      1. Location-Based Gaming
        1. Geocaching and Reverse Geocaching
        2. Mixed Reality
        3. Street Games
      2. What Time Is It?
        1. Two-Dimensional Mathematical Treatment
      3. Location, Location, Location
        1. Distance
        2. Great-Circle Heading
        3. Rhumb Line
    4. 23. Pressure Sensors and Load Cells
      1. Under Pressure
        1. Example Effects of High Pressure
      2. Button Mashing
        1. Load Cells
          1. Tiny scales
          2. Center of gravity
      3. Barometers
    5. 24. 3D Display
      1. Binocular Vision
      2. Stereoscopic Basics
        1. The Left and Right Frustums
      3. Types of Display
        1. Complementary-Color Anaglyphs
        2. Linear and Circular Polarization
        3. Liquid-Crystal Plasma
        4. Autostereoscopy
        5. Advanced Technologies
      4. Programming Considerations
        1. Active Stereoization
        2. Passive Stereoization
    6. 25. Optical Tracking
      1. Sensors and SDKs
        1. Kinect
        2. OpenCV
      2. Numerical Differentiation
    7. 26. Sound
      1. What Is Sound?
      2. Characteristics of and Behavior of Sound Waves
        1. Harmonic Wave
        2. Superposition
        3. Speed of Sound
        4. Attenuation
        5. Reflection
        6. Doppler Effect
      3. 3D Sound
        1. How We Hear in 3D
        2. A Simple Example
  7. A. Vector Operations
    1. Vector Class
      1. Magnitude
      2. Normalize
      3. Reverse
      4. Vector Addition: The += Operator
      5. Vector Subtraction: The −= Operator
      6. Scalar Multiplication: The *= Operator
      7. Scalar Division: The /= Operator
      8. Conjugate: The − Operator
    2. Vector Functions and Operators
      1. Vector Addition: The + Operator
      2. Vector Subtraction: The − Operator
      3. Vector Cross Product: The ^ Operator
      4. Vector Dot Product: The * Operator
      5. Scalar Multiplication: The * Operator
      6. Scalar Division: The / Operator
      7. Triple Scalar Product
  8. B. Matrix Operations
    1. Matrix3×3 Class
      1. Determinant
      2. Transpose
      3. Inverse
      4. Matrix Addition: The += Operator
      5. Matrix Subtraction: The −= Operator
      6. Scalar Multiplication: The *= Operator
      7. Scalar Division: The /= Operator
    2. Matrix Functions and Operators
      1. Matrix Addition: The + Operator
      2. Matrix Subtraction: The − Operator
      3. Scalar Divide: The / Operator
      4. Matrix Multiplication: The * Operator
      5. Scalar Multiplication: The * Operator
      6. Vector Multiplication: The * Operator
  9. C. Quaternion Operations
    1. Quaternion Class
      1. Magnitude
      2. GetVector
      3. GetScalar
      4. Quaternion Addition: The += Operator
      5. Quaternion Subtraction: The −= Operator
      6. Scalar Multiplication: The *= Operator
      7. Scalar Division: The /= Operator
      8. Conjugate: The ~ Operator
    2. Quaternion Functions and Operators
      1. Quaternion Addition: The + Operator
      2. Quaternion Subtraction: The − Operator
      3. Quaternion Multiplication: The * Operator
      4. Scalar Multiplication: The * Operator
      5. Vector Multiplication: The * Operator
      6. Scalar Division: The / Operator
      7. QGetAngle
      8. QGetAxis
      9. QRotate
      10. QVRotate
      11. MakeQFromEulerAngles
      12. MakeEulerAnglesFromQ
      13. Conversion Functions
  10. D. Bibliography
    1. General Physics and Dynamics
    2. Mathematics and Numerical Methods
    3. Computational Geometry
    4. Projectiles
    5. Sports Ball Physics
    6. Aerodynamics
    7. Hydrostatics and Hydrodynamics
    8. Automobile Physics
    9. Real-time Physics Simulations
    10. Digital Physics
  11. Index
  12. About the Authors
  13. Colophon
  14. Special Upgrade Offer
  15. Copyright