Welcome to Learning Physics Modeling with PhysX. Video games are emerging as a new form of entertainment, and are developed for all kind of platforms, such as PCs, consoles, Tablet PC, mobile phones, and other hand-held devices. Current-generation games are much more sophisticated and complex than ever. Third- party physics engines are widely used in video games as middleware to achieve a physically-realistic world behavior such as gravity, acceleration, collision, force, friction, and so on. Nvidia PhysX is the state-of-the-art cross-platform physics engine that is widely used by top-notch game studios and developers. It contains virtually all of the physics-related components that a developer may want to integrate into their game. PhysX Physics Engine exploits the parallel-processing capability of a modern GPU as well as multi-core CPUs to make a game as physically realistic as possible.
PhysX Physics Engine is not only useful for game developers but also for developers who want to make an interactive walkthrough, training, or any other 3D application that requires real-time physics simulation.
Chapter 1, Starting with PhysX 3 SDK, covers a brief history, features, licence terms, system requirements, and what's new in PhysX SDK. We will also learn how to configure PhysX SDK with VC++ 2010 compiler.
Chapter 2, Basic Concepts, covers the basic concepts of PhysX SDK, including terminologies such as scenes, actors, materials, shapes, and how they are created, updated, and destroyed in PhysX SDK.
Chapter 3, Rigid Body Dynamics, covers rigid body properties such as mass, density, gravity, velocity, force, torque, and damping, and how we can modify these in PhysX SDK. We will also learn about kinematic actors, sleeping state, and the solver accuracy of a rigid body.
Chapter 4, Collision Detection, covers collision shapes and their types, trigger shapes, collision detection phases such as Broad-Phase Collision Detection, Narrow Phase Collision Detection, Enabling Continuous Collision Detection (CCD), and so on.
Chapter 5, Joints, explains exploring joints and their types, such as a fixed joint, revolute joint, spherical joint, distance joint, prismatic joint, and D6 joint.
Chapter 6, Scene Queries, covers types of scene queries such as raycast queries, sweep queries and overlap queries, and their mode operations.
Chapter 7, Character Controller, covers the basics of a character controller, including creating and moving a character controller, updating its size, and other related properties such as auto stepping and slope limit.
Chapter 8, Particles, covers the creation of particles, and particle systems, and their types. We will learn about particle system properties and particle creation, updating, and releasing. We will also cover particle drains and collision filtering.
Chapter 9, Cloth, covers creation of cloth and cloth fabric, tweaking cloth properties such as cloth collision, cloth particle motion constraint and separation constraint, cloth self-collision, intercollision, and GPU acceleration.
Chapter 10, PhysX Visual Debugger (PVD), covers the basics of PVD, connecting to PVD using TCP/IP network, saving a PVD datafile to a disk, and PVD connection flags.
You need a Windows PC (preferably with Windows 7 OS or higher) with Microsoft Visual C++ 2010 Express compiler installed on it. You can download VC++ 2010 Express for free from http://www.microsoft.com. You also need to download Nvidia PhysX SDK 3.3.0 from https://developer.nvidia.com/physx-downloads, which requires you to register for the Nvidia Developer Program. You may also want to download the freeglut library for Windows, which is freely available at http://freeglut.sourceforge.net. This library is used in the example code to render the PhysX components.
This book is for game developers, hobbyists, or anybody who wants to learn about the PhysX Physics Engine with minimal prior knowledge of it. You don't have to be a die-hard programmer to get started with this book. Basic knowledge of C++, 3D mathematics, and OpenGL will be fine.
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "We can explicitly wake an actor by calling PxRigidDynamic::wakeUp()
, which requires an optional real value that determines how long until the body is put to sleep."
A block of code is set as follows:
PxMaterial* mMaterial = gPhysicsSDK->createMaterial(0.5,0.5,0.5); PxRigidDynamic* sphere = gPhysicsSDK->createRigidDynamic(spherePos); sphere->createShape(PxSphereGeometry(0.5f), *mMaterial);
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes, for example, appear in the text like this: "We have to include the PhysX library files and header files in VC++ Directories that can be found at View | Property Pages."
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>
, and mention the book title in the subject of your message.
If there is a topic that you have expertise in and on which you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
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 files e-mailed directly to you.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us to improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at <[email protected]>
if you are having a problem with any aspect of the book, and we will do our best to address it.