Game Physics Cookbook

Discover over 100 easy-to-follow recipes to help you implement efficient game physics and collision detection in your games
Preview in Mapt

Game Physics Cookbook

Gabor Szauer

2 customer reviews
Discover over 100 easy-to-follow recipes to help you implement efficient game physics and collision detection in your games
Mapt Subscription
FREE
$29.99/m after trial
eBook
$28.00
RRP $39.99
Save 29%
Print + eBook
$49.99
RRP $49.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$28.00
$49.99
$29.99p/m after trial
RRP $39.99
RRP $49.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


Game Physics Cookbook Book Cover
Game Physics Cookbook
$ 39.99
$ 28.00
Learning Game Physics with Bullet Physics and OpenGL Book Cover
Learning Game Physics with Bullet Physics and OpenGL
$ 17.99
$ 12.60
Buy 2 for $30.10
Save $27.88
Add to Cart
Subscribe and access every Packt eBook & Video.
 
  • 5,000+ eBooks & Videos
  • 50+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 

Book Details

ISBN 139781787123663
Paperback480 pages

Book Description

Physics is really important for game programmers who want to add realism and functionality to their games. Collision detection in particular is a problem that affects all game developers, regardless of the platform, engine, or toolkit they use.

This book will teach you the concepts and formulas behind collision detection. You will also be taught how to build a simple physics engine, where Rigid Body physics is the main focus, and learn about intersection algorithms for primitive shapes.

You’ll begin by building a strong foundation in mathematics that will be used throughout the book. We’ll guide you through implementing 2D and 3D primitives and show you how to perform effective collision tests for them. We then pivot to one of the harder areas of game development—collision detection and resolution.

Further on, you will learn what a Physics engine is, how to set up a game window, and how to implement rendering. We’ll explore advanced physics topics such as constraint solving. You’ll also find out how to implement a rudimentary physics engine, which you can use to build an Angry Birds type of game or a more advanced game.

By the end of the book, you will have implemented all primitive and some advanced collision tests, and you will be able to read on geometry and linear Algebra formulas to take forward to your own games!

Table of Contents

Chapter 1: Vectors
Introduction
Vector definition
Component-wise operations
Dot product
Magnitude
Normalizing
Cross product
Angles
Projection
Reflection
Chapter 2: Matrices
Introduction
Matrix definition
Transpose
Multiplication
Identity matrix
Determinant of a 2x2 matrix
Matrix of minors
Cofactor
Determinant of a 3x3 matrix
Operations on a 4x4 matrix
Adjugate matrix
Matrix inverse
Chapter 3: Matrix Transformations
Introduction
Matrix majors
Translation
Scaling
How rotations work
Rotation matrices
Axis angle rotation
Vector matrix multiplication
Transform matrix
View matrix
Projection matrix
Chapter 4: 2D Primitive Shapes
Introduction
2D points
2D lines
Circle
Rectangle
Oriented rectangle
Point containment
Line intersection
Chapter 5: 2D Collisions
Introduction
Circle to circle
Circle to rectangle
Circle to oriented rectangle
Rectangle to rectangle
Separating Axis Theorem
Rectangle to oriented rectangle
Oriented rectangle to oriented rectangle
Chapter 6: 2D Optimizations
Introduction
Containing circle
Containing rectangle
Simple and complex shapes
Quad tree
Broad phase collisions
Chapter 7: 3D Primitive Shapes
Introduction
Point
Line segment
Ray
Sphere
Axis Aligned Bounding Box
Oriented Bounding Box
Plane
Triangle
Chapter 8: 3D Point Tests
Introduction
Point and sphere
Point and AABB
Point and Oriented Bounding Box
Point and plane
Point and line
Point and ray
Chapter 9: 3D Shape Intersections
Introduction
Sphere-to-sphere
Sphere-to-AABB
Sphere-to-OBB
Sphere-to-plane
AABB-to-AABB
AABB-to-OBB
AABB-to-plane
OBB-to-OBB
OBB-to-plane
Plane-to-plane
Chapter 10: 3D Line Intersections
Introduction
Raycast Sphere
Raycast Axis Aligned Bounding Box
Raycast Oriented Bounding Box
Raycast plane
Linetest Sphere
Linetest Axis Aligned Bounding Box
Linetest Oriented Bounding Box
Linetest Plane
Chapter 11: Triangles and Meshes
Introduction
Point in triangle
Closest point triangle
Triangle to sphere
Triangle to Axis Aligned Bounding Box
Triangle to Oriented Bounding Box
Triangle to plane
Triangle to triangle
Robustness of the Separating Axis Theorem
Raycast Triangle
Linetest Triangle
Mesh object
Mesh optimization
Mesh operations
Chapter 12: Models and Scenes
Introduction
The Model object
Operations on models
The Scene object
Operations on the scene
The Octree object
Octree contents
Operations on the Octree
Octree scene integration
Chapter 13: Camera and Frustum
Introduction
Camera object
Camera controls
Frustum object
Frustum from matrix
Sphere in frustum
Bounding Box in frustum
Octree culling
Picking
Chapter 14: Constraint Solving
Introduction
Framework introduction
Raycast sphere
Raycast Bounding Box
Raycast plane and triangle
Physics system
Integrating particles
Solving constraints
Verlet Integration
Chapter 15: Manifolds and Impulses
Introduction
Manifold for spheres
Manifold for boxes
Rigidbody Modifications
Linear Velocity
Linear Impulse
Physics System Update
Angular Velocity
Angular Impulse
Chapter 16: Springs and Joints
Introduction
Particle Modifications
Springs
Cloth
Physics System Modification
Joints

What You Will Learn

  • Implement fundamental maths so you can develop solid game physics
  • Use matrices to encode linear transformations
  • Know how to check geometric primitives for collisions
  • Build a Physics engine that can create realistic rigid body behavior
  • Understand advanced techniques, including the Separating Axis Theorem
  • Create physically accurate collision reactions
  • Explore spatial partitioning as an acceleration structure for collisions
  • Resolve rigid body collisions between primitive shapes

Authors

Table of Contents

Chapter 1: Vectors
Introduction
Vector definition
Component-wise operations
Dot product
Magnitude
Normalizing
Cross product
Angles
Projection
Reflection
Chapter 2: Matrices
Introduction
Matrix definition
Transpose
Multiplication
Identity matrix
Determinant of a 2x2 matrix
Matrix of minors
Cofactor
Determinant of a 3x3 matrix
Operations on a 4x4 matrix
Adjugate matrix
Matrix inverse
Chapter 3: Matrix Transformations
Introduction
Matrix majors
Translation
Scaling
How rotations work
Rotation matrices
Axis angle rotation
Vector matrix multiplication
Transform matrix
View matrix
Projection matrix
Chapter 4: 2D Primitive Shapes
Introduction
2D points
2D lines
Circle
Rectangle
Oriented rectangle
Point containment
Line intersection
Chapter 5: 2D Collisions
Introduction
Circle to circle
Circle to rectangle
Circle to oriented rectangle
Rectangle to rectangle
Separating Axis Theorem
Rectangle to oriented rectangle
Oriented rectangle to oriented rectangle
Chapter 6: 2D Optimizations
Introduction
Containing circle
Containing rectangle
Simple and complex shapes
Quad tree
Broad phase collisions
Chapter 7: 3D Primitive Shapes
Introduction
Point
Line segment
Ray
Sphere
Axis Aligned Bounding Box
Oriented Bounding Box
Plane
Triangle
Chapter 8: 3D Point Tests
Introduction
Point and sphere
Point and AABB
Point and Oriented Bounding Box
Point and plane
Point and line
Point and ray
Chapter 9: 3D Shape Intersections
Introduction
Sphere-to-sphere
Sphere-to-AABB
Sphere-to-OBB
Sphere-to-plane
AABB-to-AABB
AABB-to-OBB
AABB-to-plane
OBB-to-OBB
OBB-to-plane
Plane-to-plane
Chapter 10: 3D Line Intersections
Introduction
Raycast Sphere
Raycast Axis Aligned Bounding Box
Raycast Oriented Bounding Box
Raycast plane
Linetest Sphere
Linetest Axis Aligned Bounding Box
Linetest Oriented Bounding Box
Linetest Plane
Chapter 11: Triangles and Meshes
Introduction
Point in triangle
Closest point triangle
Triangle to sphere
Triangle to Axis Aligned Bounding Box
Triangle to Oriented Bounding Box
Triangle to plane
Triangle to triangle
Robustness of the Separating Axis Theorem
Raycast Triangle
Linetest Triangle
Mesh object
Mesh optimization
Mesh operations
Chapter 12: Models and Scenes
Introduction
The Model object
Operations on models
The Scene object
Operations on the scene
The Octree object
Octree contents
Operations on the Octree
Octree scene integration
Chapter 13: Camera and Frustum
Introduction
Camera object
Camera controls
Frustum object
Frustum from matrix
Sphere in frustum
Bounding Box in frustum
Octree culling
Picking
Chapter 14: Constraint Solving
Introduction
Framework introduction
Raycast sphere
Raycast Bounding Box
Raycast plane and triangle
Physics system
Integrating particles
Solving constraints
Verlet Integration
Chapter 15: Manifolds and Impulses
Introduction
Manifold for spheres
Manifold for boxes
Rigidbody Modifications
Linear Velocity
Linear Impulse
Physics System Update
Angular Velocity
Angular Impulse
Chapter 16: Springs and Joints
Introduction
Particle Modifications
Springs
Cloth
Physics System Modification
Joints

Book Details

ISBN 139781787123663
Paperback480 pages
Read More
From 2 reviews

Read More Reviews

Recommended for You

Unity 5.x Cookbook Book Cover
Unity 5.x Cookbook
$ 43.99
$ 30.80
Procedural Content Generation for Unity Game Development Book Cover
Procedural Content Generation for Unity Game Development
$ 39.99
$ 28.00
Mastering Unity 2D Game Development Book Cover
Mastering Unity 2D Game Development
$ 32.99
$ 6.60
Building a Game with Unity and Blender Book Cover
Building a Game with Unity and Blender
$ 35.99
$ 25.20
Unity UI Cookbook Book Cover
Unity UI Cookbook
$ 39.99
$ 28.00
Unity 5.x Game AI Programming Cookbook Book Cover
Unity 5.x Game AI Programming Cookbook
$ 35.99
$ 25.20