• Complain

Gabor Szauer [Gabor Szauer] - Game Physics Cookbook

Here you can read online Gabor Szauer [Gabor Szauer] - Game Physics Cookbook full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2017, publisher: Packt Publishing, genre: Children. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Gabor Szauer [Gabor Szauer] Game Physics Cookbook

Game Physics Cookbook: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Game Physics Cookbook" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

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

About 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 engine

Who This Book Is For

This book is for beginner to intermediate game developers. You dont need to have a formal education in gamesyou 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 shapes

In Detail

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.

Youll begin by building a strong foundation in mathematics that will be used throughout the book. Well 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 developmentcollision 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. Well explore advanced physics topics such as constraint solving. Youll 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 approach

Gain 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.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Gabor Szauer [Gabor Szauer]: author's other books


Who wrote Game Physics Cookbook? Find out the surname, the name of the author of the book and a list of all author's works by series.

Game Physics Cookbook — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Game Physics Cookbook" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Appendix A. Advanced Topics

Congratulations on making it to the final chapter! Detecting collisions and building a physics engine is hard work. We have covered a lot of ground, but there is still more to learn. This chapter will provide an overview of some advanced features you can add to your physics engine and provide resources on where to go from here. In this chapter, the following topics will be covered:

  • Generic collisions
  • Stability improvements
  • Open source physics engines
  • Books
  • Online resources
  • Summary
Introduction

We have covered a lot in this book; starting from 3D math, we worked our way up to simulating 3D physics.

There is still much room for improvement. This chapter is dedicated to give guidance on advanced concepts that you can research and implement to make your physics engine even better.

After covering some of these advanced topics, I will provide a list of books, open source projects, and online resources you can use to take your physics simulation to the next level!

Generic collisions

A large part of this book was dedicated to finding the most efficient way of determining whether two shapes intersect. The most robust, general purpose algorithm we have talked about so far has been Separating Axis Theorem ( SAT ). SAT has several limitations, the biggest one being curved surfaces. The execution time of SAT also gets out of hand when a complex mesh has many faces.

In this section, we will discuss a different generic algorithm--the Gilbert Johnson Keerthi or GJK algorithm. GJK runs in near linear time, often outperforming SAT. However, it is difficult to achieve the stability SAT provides using GJK. GJK should be used to find intersection data with complex meshes that have many faces. The GJK algorithm needs a support function to work, and this support function is called Minkowski Sum .

Note

For an algorithm to run in linear time, adding an iteration increases the execution time of the algorithm by the same amount every time, regardless of the size of the dataset. More information on runtimes is available online at https://en.wikipedia.org/wiki/Time_complexity.

Minkowski Sum

The Minkowski Sum, also called Minkowski Addition , is an operation that we perform on two shapes; let's call them A and B . Given these input shapes, the result of the Minkowski Sum operation is a new shape that looks like shape A was swept along the surface of shape B . The following image demonstrates what this looks like:

We can describe this operation as every point in the Minkowski Sum is a point - photo 1

We can describe this operation as every point in the Minkowski Sum is a point from shape A added to a point from shape B . We can express this with the following equation:

Note The preceding equation might be hard to read The symbol means element of - photo 2
Note

The preceding equation might be hard to read. The Picture 3 symbol means element of and the Picture 4 symbol means the direct sum of two groups. We are defining how to take the direct sum of two shapes that might not have the same number of vertices.

This means that we find the Minkowski Sum of two shapes by adding all the vertices of each shape together. If we take object B and reflect it around the origin, we effectively negate B :

We often refer to taking the Minkowski Sum of A B as the Minkowski - photo 5

We often refer to taking the Minkowski Sum of A + ( B ) as the Minkowski Difference because it can be expressed as ( AB ). The Minkowski Difference produces what is called a Configuration Space Object or CSO .

If two shapes intersect, their resulting CSO will contain the origin of the coordinate system (0, 0, 0). If the two objects do not intersect, the CSO will not contain the origin.

This property makes the Minkowski Sum a very useful tool for generic collision detection. The shape of each object does not matter; so long as the CSO of the objects contains the origin, we know that the objects intersect.

Gilbert Johnson Keerthi (GJK)

Taking the Minkowski Difference of two complex shapes can be rather time consuming. Checking whether the resulting CSO contains the origin can be time consuming as well. The Gilbert Johnson Keerthi, or GJK, algorithm addresses these issues. The most comprehensive coverage of GJK is presented by Casey Muratori , which is available on the Molly Rocket website at https://mollyrocket.com/849.

The GJK algorithm, like the SAT algorithm, only works with convex shapes. However, unlike the SAT, implementing GJK for curved shapes is fairly easy. Any shape can be used with GJK so long as the shape has a support function implemented. The support function for GJK finds a point along the CSO of two objects, given a direction. As we only need an object in a direction, there is no need to construct the full CSO using the Minkowski Difference.

GJK is a fast iterative method; in many cases, GJK will run in linear time. This means for many cases, GJK is faster than SAT. GJK works by creating a simplex and refining it iteratively. A simplex is the generalized notion of a triangle in any arbitrary dimensions. For example, in two dimensions, a simplex is a triangle. In three dimensions, a simplex is a tetrahedron and in four dimensions, a simplex is a five cell. A simplex in k-dimensions will always have k + 1 vertices:

Once the simplex produced by GJK contains the origin we know that we have an - photo 6

Once the simplex produced by GJK contains the origin, we know that we have an intersection. If the support point used to refine the simplex is further from the origin than the previous closest point, no collision has happened. GJK can be implemented using the following nine steps:

  1. Initialize the (empty) simplex.
  2. Use some direction to find a support point on the CSO.
  3. Add the support point to the simplex.
  4. Find the closest point in the simplex to the origin.
  5. If the closest point is the origin, return a collision.
  6. Else, reduce the simplex so that it still contains the closest point.
  7. Use the direction from the closest point to origin to find a new support point.
  8. If the new support is further from origin than the closest point, return no collision.
  9. Add the new support to the simplex and go to step 4.
Expanding Polytope Algorithm (EPA)

The GJK algorithm is generic and fairly fast; it will tell us if two objects intersect. The information provided by GJK is enough to detect when objects intersect, but not enough to resolve that intersection. To resolve a collision, we need to know the collision normal, a contact point, and a penetration depth.

This additional data can be found using the Expanding Polytope Algorithm ( EPA ). A detailed discussion of the EPA algorithm is available on YouTube in the form of a video by Andrew at https://www.youtube.com/watch?v=6rgiPrzqt9w. Like the GJK, the EPA uses the Minkowski Difference as a support function.

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Game Physics Cookbook»

Look at similar books to Game Physics Cookbook. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Game Physics Cookbook»

Discussion, reviews of the book Game Physics Cookbook and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.