What are PhysX Snippets?

In the context of the PhysX SDK, a ‘Snippet’ is a simple, self contained code sample. PhysX SDK offers a collection of Snippets to illustrate the usage of the PhysX API in a concise format, free from the complexity of a sample framework or game engine. The Snippets folder is in the top-level directory of the PhysX SDK, alongside directories for Documentation, Include etc.

The folder {SDK Root}/compiler/{platform}/sdk_snippets_bin/ contains the Snippets solution file, e.g.


There are several snippets and some of them support rendering, while some neither support rendering nor require any input. Although the snippets can be run from a command prompt or by double-clicking the executable icon, the best way to explore Snippets is by viewing the code in the Visual Studio IDE, and running the program in the debugger.


SnippetOmniPVD is not active in release mode of the PhysX SDK

HelloWorld: PhysX Basics

SnippetHelloWorld illustrates basic use of PhysX, from startup to shutdown of a simple scene, and is a good place to start learning the PhysX API. The simplest Snippets comprise a single source file, but SnippetHelloWorld, among others, supports optional rendering through a second source file. SnippetHelloWorld creates a number of box stacks on a plane, and if rendering is enabled, allows the user to create new stacks and fire a ball from the camera position.

The primary code for SnippetHelloWorld is found in {SDK Root}/snippets/snippethelloworld/SnippetHelloWorld.cpp.