Game Physics Cookbook
eBook - ePub

Game Physics Cookbook

  1. 480 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Game Physics Cookbook

About this book

Discover over 100 easy-to-follow recipes to help you implement efficient game physics and collision detection in your gamesAbout This Book• Get a comprehensive coverage of techniques to create high performance collision detection in games• Learn the core mathematics concepts and physics involved in depicting collision detection for your games• Get a hands-on experience of building a rigid body physics engineWho This Book Is ForThis book is for beginner to intermediate game developers. You don't need to have a formal education in games—you can be a hobbyist or indie developer who started making games with Unity 3D.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 shapesIn DetailPhysics 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!Style and approachGain the necessary skills needed to build a Physics engine for your games through practical recipes, in an easy-to-read manner. Every topic explained in the book has clear, easy to understand code accompanying it.

Tools to learn more effectively

Saving Books

Saving Books

Keyword Search

Keyword Search

Annotating Text

Annotating Text

Listen to it instead

Listen to it instead

Information

Game Physics Cookbook


Table of Contents

Game Physics Cookbook
Credits
About the Author
Acknowledgements
About the Reviewer
Acknowledgements
www.PacktPub.com
eBooks, discount offers, and more
Why Subscribe?
Customer Feedback
Preface
What this book covers
What you need for this book
Who this book is for
Sections
Getting ready
How to do it…
How it works…
There's more…
See also
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Vectors
Introduction
Vector definition
Getting ready
How to do it…
How it works…
There's more…
The W component
Component-wise operations
Getting ready
How to do it…
How it works…
Addition
Subtraction
Multiplication (Vector and Scalar)
Comparison
There's more…
Dot product
How to do it…
How it works…
There's more…
Geometric definition
Magnitude
Getting ready
How to do it…
How it works…
There's more…
Normalizing
Getting ready
How to do it…
How it works…
Cross product
Getting ready
How to do it…
How it works…
Angles
Getting ready
How to do it…
How it works…
There's more…
Radians and degrees
Projection
Getting ready
How to do it…
How it works…
Reflection
Getting ready
How to do it…
How it works…
2. Matrices
Introduction
Matrix definition
Getting ready
How to do it…
How it works…
Transpose
Getting ready
How to do it…
How it works…
Multiplication
Getting ready
How to do it…
How it works…
Identity matrix
Getting ready
How to do it…
How it works…
Determinant of a 2x2 matrix
How to do it…
How it works…
Matrix of minors
Getting ready
How to do it…
How it works…
Minor of a 2x2 matrix
Minor of a 3x3 matrix
Cofactor
Getting ready
How to do it…
How it works…
Determinant of a 3x3 matrix
Getting ready
How to do it…
How it works…
Operations on a 4x4 matrix
Getting ready
How to do it…
How it works…
Adjugate matrix
Getting ready
How to do it…
How it works…
Matrix inverse
Getting ready
How to do it…
How it works…
There's more…
Expanding the inverse
3. Matrix Transformations
Introduction
Matrix majors
Translation
Getting Ready
How to do it…
How it works…
Scaling
Getting ready
How to do it…
How it works…
How rotations work
Getting ready
How to do it…
How it works…
Rotation matrices
Getting ready
How to do it…
How it works…
X-Basis vector
Y-Basis vector
Z-Basis vector
There's more…
X and Y rotation
Axis angle rotation
Getting ready
How to do it…
How it works…
Vector matrix multiplication
Getting ready
How to do it…
How it works…
Transform matrix
Getting ready
How to do it…
How it works…
View matrix
Getting ready
How to do it…
How it works…
Projection matrix
Getting ready
How to do it…
How it works…
4. 2D Primitive Shapes
Introduction
2D points
Getting ready
How to do it…
How it works…
2D lines
Getting ready
How to do it…
How it works…
Circle
Getting ready
How to do it…
How it works…
Rectangle
Getting ready
How to do it…
How it works…
Oriented rectangle
Getting ready
How to do it…
How it works…
Point containment
Getting ready
How to do it…
How it works…
Point on a line
Point in a circle
Point in a rectangle
Point in an oriented rectangle
Line intersection
Getting ready
How to do it…
How it works…
Line circle
Line rectangle
Line oriented rectangle
5. 2D Collisions
Introduction
Circle to circle
Getting ready
How to do it…
How it works…
Circle to rectangle
Getting ready
How to do it…
How it works…
There's more…
Circle to oriented rectangle
Getting ready
How to do it…
How it works…
Rectangle to rectangle
Getting ready
How to do it…
How it works…
Separating Axis Theorem
Getting ready
How to do it…
How it works…
There's more…
Determining which axis to test
Rectangle to oriented rectangle
Getting ready
How to do it…
How it works…
Oriented rectangle to oriented rectangle
Getting ready
How to do it…
How it works…
6. 2D Optimizations
Introduction
Containing circle
Getting ready
How to do it…
How it works…
Containing rectangle
Getting ready
How to do it…
How it works…
Simple and complex shapes
Getting ready
How to do it…
How it works…
Quad tree
Getting ready
How to do it…
How it works…
Broad phase collisions
Getting ready
How to do it…
How it works…
7. 3D Primitive Shapes
Introduction
Point
Getting ready
How to do it…
How it works…
Line segment
Getting ready
How to do it…
How it works…
Ray
Ge...

Table of contents

  1. Game Physics Cookbook

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access Game Physics Cookbook by Gabor Szauer in PDF and/or ePUB format, as well as other popular books in Computer Science & Computer Graphics. We have over one million books available in our catalogue for you to explore.