Book Image

Learning Physics Modeling with PhysX

By : Krishna Kumar
Book Image

Learning Physics Modeling with PhysX

By: Krishna Kumar

Overview of this book

<p>In this day and age, physics engines play a very critical role in the success of a sophisticated game. PhysX is a state-of-the-art cross-platform physics engine widely used by top game studios and developers. It contains all the physics-related components you will need and exploits the parallel-processing capability of modern GPUs as well as multi-core CPUs to make a game as physically-realistic as possible. This book will help you to program and simulate games by using PhysX 3.</p> <p>Learning Physics Modeling with PhysX helps you to master physics simulation using the PhysX Physics Engine from scratch. This is useful not only for game developers, but also for developers making virtual walkthroughs or training and other simulation applications. It will cover all the essential features of PhysX 3 with easy-to-understand code snippets and examples to help you learn quickly and efficiently.</p> <p>This book will start off by introducing you to the basic concepts of physic engines and will give you a glimpse of PhysX implementation. We then gradually cover more sophisticated topics with sample source code so that you can see what you have learned in action. We will cover the history and features of the PhysX SDK as well as how to configure it with the C++ compiler. After touching upon essential topics like rigid body dynamics and collision detection, we will gradually move on to more advanced topics like joints, scene queries, character controllers, particles, and cloth simulation. By the end of this book, you will have learned everything you need to know about the PhysX 3 Physics Engine, and you will be able to use it to program your very own physics simulation quickly and efficiently.</p>
Table of Contents (17 chapters)
Learning Physics Modeling with PhysX
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Configuring with VC++ Express 2010


We will use Microsoft Visual C++ 2010 Express for compiling the PhysX program. It is freely available at www.microsoft.com. We have to include the PhysX library files and header files in VC++ Directories that can be found at View | Property Pages. Property Pages can also be modified from Property Manager. A Property Manager window enables us to modify project settings that are defined in property sheets. A project property sheet is basically an .xml file that is used to save project configurations and can also be applied to multiple projects because it is inheritable.

Configuring VC++ 2010 Express requires the following steps:

  1. After downloading the PhysX 3.x SDK for the Windows platform, which comes in a ZIP file, you need to extract it to any preferred location on your PC. For this book, we will extract the PhysX SDK's ZIP file to C:\dev. Finally, our PhysX SDK location will look like C:\dev\PhysX-3.3.0_PC_SDK_Core.

  2. Before including the PhysX library files and header files in Property Manager, we first need to create a new Visual C++ Win32 Console application. To do this, open your MS VC++ compiler from the toolbar and navigate to File | New | Project. Then, a New Project window will pop up. Select Win32 Console Application and also provide Name and Location for the project. Finally, click on the OK button to proceed further as shown in the following screenshot:

  3. Soon after, a Win32 Application Wizard window will pop up. Here, click on the Next button to get the Application Settings screen, where you need to make sure that the Empty project option is checked under Additional options. Finally, click on the Finish button as shown in the following screenshot:

  4. Next, we need to configure our project's VC++ directories so that it can find the PhysX SDK header files and libraries that are required for compiling the PhysX program. We will include the absolute path for PhysX SDK Include Directories and Library Directories. To do this in VC++ 2010 Express, navigate to View | Property Manager. If the Property Manager option is not visible there, navigate to Tools | Settings and select Expert Settings; this will enable the Property Manager option in View. In the Property Manager window, double-click on a configuration-and-platform node, for example, Debug | Win32 or Release | Win32, as shown in the following screenshot:

  5. Double-clicking on a configuration-and-platform node, such as Debug | Win32 or Release | Win32, will open Property pages for the respective node configuration, such as, Debug Property Pages or Release Property Pages. This can also be opened by navigating to View | Property pages.

  6. When configuration-specific Property Pages (namely Debug Property Pages or Release Property Pages) will pop up, select VC++ Directories and add the following entries:

    1. Select Include Directories and then click on <Edit...> to add C:\dev\PhysX-3.3.0_PC_SDK_Core\Include.

    2. Select Library Directories and then click on <Edit...> to add C:\dev\PhysX-3.3.0_PC_SDK_Core\Lib\win32 (for a 32-bit platform) or C:\dev\PhysX-3.3.0_PC_SDK_Core\Lib\win64 (for a 64-bit platform).

    Note

    For this book, we will include libraries for a 32-bit platform because it can run on either a 32-bit machine or a 64-bit machine.

  7. Finally, click on the OK button to save your changes and close the window.

These PhysX SDK directory settings are saved on a per user basis and not on per project basis. So whenever you create a new VC++ project in VC++ 2010 Express, PhysX directories will automatically be added to your Include Directories project. We are now finally done with the PhysX configuration in VC++ 2010 Express. In the next chapter, we will create our first PhysX program.