PxCreatePhysics

Defined in include/PxPhysics.h

inline physx::PxPhysics *PxCreatePhysics(physx::PxU32 version, physx::PxFoundation &foundation, const physx::PxTolerancesScale &scale, bool trackOutstandingAllocations = false, physx::PxPvd *pvd = NULL, physx::PxOmniPvd *omniPvd = NULL)

Creates an instance of the physics SDK.

Creates an instance of this class. May not be a class member to avoid name mangling. Pass the constant PX_PHYSICS_VERSION as the argument. There may be only one instance of this class per process. Calling this method after an instance has been created already will result in an error message and NULL will be returned.

Calling this will register all optional code modules (Articulations and HeightFields), preparing them for use. If you do not need some of these modules, consider calling PxCreateBasePhysics() instead and registering needed modules manually.

Parameters
  • version – Version number we are expecting (should be PX_PHYSICS_VERSION)

  • foundation – Foundation instance (see PxFoundation)

  • scale – values used to determine default tolerances for objects at creation time

  • trackOutstandingAllocations – true if you want to track memory allocations so a debugger connection partway through your physics simulation will get an accurate map of everything that has been allocated so far. This could have a memory and performance impact on your simulation hence it defaults to off.

  • pvd – When pvd points to a valid PxPvd instance (PhysX Visual Debugger), a connection to the specified PxPvd instance is created. If pvd is NULL no connection will be attempted.

  • omniPvd – When omniPvd points to a valid PxOmniPvd instance PhysX will sample its internal structures to the defined OmniPvd output streams set in the PxOmniPvd object.

Returns

PxPhysics instance on success, NULL if operation failed