PxPhysics

Defined in include/PxPhysics.h

class PxPhysics

Abstract singleton factory class used for instancing objects in the Physics SDK.

In addition you can use PxPhysics to set global parameters which will effect all scenes and create objects that can be shared across multiple scenes.

You can get an instance of this class by calling PxCreateBasePhysics() or PxCreatePhysics() with pre-registered modules.

Basics

inline virtual ~PxPhysics()
virtual void release() = 0

Destroys the instance it is called on.

Use this release method to destroy an instance of this class. Be sure to not keep a reference to this object after calling release. Avoid release calls while a scene is simulating (in between simulate() and fetchResults() calls).

Note that this must be called once for each prior call to PxCreatePhysics, as there is a reference counter. Also note that you mustn’t destroy the PxFoundation instance (holding the allocator, error callback etc.) until after the reference count reaches 0 and the SDK is actually removed.

Releasing an SDK will also release any objects created through it (scenes, triangle meshes, convex meshes, heightfields, shapes etc.), provided the user hasn’t already done so.

Note

Releasing the PxPhysics instance is a prerequisite to releasing the PxFoundation instance.

virtual PxFoundation &getFoundation() = 0

Retrieves the Foundation instance.

Returns

A reference to the Foundation object.

virtual PxOmniPvd *getOmniPvd() = 0

Retrieves the PxOmniPvd instance if there is one registered with PxPhysics.

Returns

A pointer to a PxOmniPvd object.

virtual PxAggregate *createAggregate(PxU32 maxActor, PxU32 maxShape, PxAggregateFilterHint filterHint) = 0

Creates an aggregate with the specified maximum size and filtering hint.

The previous API used “bool enableSelfCollision” which should now silently evaluates to a PxAggregateType::eGENERIC aggregate with its self-collision bit.

Use PxAggregateType::eSTATIC or PxAggregateType::eKINEMATIC for aggregates that will only contain static or kinematic actors. This provides faster filtering when used in combination with PxPairFilteringMode.

See also

PxAggregate PxAggregateFilterHint PxAggregateType PxPairFilteringMode

Parameters
  • maxActor[in] The maximum number of actors that may be placed in the aggregate.

  • maxShape[in] The maximum number of shapes that may be placed in the aggregate.

  • filterHint[in] The aggregate’s filtering hint.

Returns

The new aggregate.

inline PxAggregate *createAggregate(PxU32 maxActor, PxAggregateFilterHint filterHint)

Creates an aggregate with the specified maximum size and filtering hint.

The previous API used “bool enableSelfCollision” which should now silently evaluates to a PxAggregateType::eGENERIC aggregate with its self-collision bit.

Use PxAggregateType::eSTATIC or PxAggregateType::eKINEMATIC for aggregates that will only contain static or kinematic actors. This provides faster filtering when used in combination with PxPairFilteringMode.

Deprecated:

See also

PxAggregate PxAggregateFilterHint PxAggregateType PxPairFilteringMode

Note

This variation of the method is not compatible with GPU rigid bodies.

Parameters
  • maxActor[in] The maximum number of actors that may be placed in the aggregate.

  • filterHint[in] The aggregate’s filtering hint.

Returns

The new aggregate.

virtual const PxTolerancesScale &getTolerancesScale() const = 0

Returns the simulation tolerance parameters.

Returns

The current simulation tolerance parameters.

Meshes

virtual PxTriangleMesh *createTriangleMesh(PxInputStream &stream) = 0

Creates a triangle mesh object.

This can then be instanced into PxShape objects.

Parameters

stream[in] The triangle mesh stream.

Returns

The new triangle mesh.

virtual PxU32 getNbTriangleMeshes() const = 0

Return the number of triangle meshes that currently exist.

Returns

Number of triangle meshes.

virtual PxU32 getTriangleMeshes(PxTriangleMesh **userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0

Writes the array of triangle mesh pointers to a user buffer.

Returns the number of pointers written.

The ordering of the triangle meshes in the array is not specified.

Parameters
  • userBuffer[out] The buffer to receive triangle mesh pointers.

  • bufferSize[in] The number of triangle mesh pointers which can be stored in the buffer.

  • startIndex[in] Index of first mesh pointer to be retrieved.

Returns

The number of triangle mesh pointers written to userBuffer, this should be less or equal to bufferSize.

Tetrahedron Meshes

virtual PxTetrahedronMesh *createTetrahedronMesh(PxInputStream &stream) = 0

Creates a tetrahedron mesh object.

This can then be instanced into PxShape objects.

Parameters

stream[in] The tetrahedron mesh stream.

Returns

The new tetrahedron mesh.

virtual PxSoftBodyMesh *createSoftBodyMesh(PxInputStream &stream) = 0

Creates a softbody mesh object.

Parameters

stream[in] The softbody mesh stream.

Returns

The new softbody mesh.

virtual PxU32 getNbTetrahedronMeshes() const = 0

Return the number of tetrahedron meshes that currently exist.

Returns

Number of tetrahedron meshes.

virtual PxU32 getTetrahedronMeshes(PxTetrahedronMesh **userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0

Writes the array of tetrahedron mesh pointers to a user buffer.

Returns the number of pointers written.

The ordering of the tetrahedron meshes in the array is not specified.

Parameters
  • userBuffer[out] The buffer to receive tetrahedron mesh pointers.

  • bufferSize[in] The number of tetrahedron mesh pointers which can be stored in the buffer.

  • startIndex[in] Index of first mesh pointer to be retrieved.

Returns

The number of tetrahedron mesh pointers written to userBuffer, this should be less or equal to bufferSize.

virtual PxHeightField *createHeightField(PxInputStream &stream) = 0

Creates a heightfield object from previously cooked stream.

This can then be instanced into PxShape objects.

Parameters

stream[in] The heightfield mesh stream.

Returns

The new heightfield.

virtual PxU32 getNbHeightFields() const = 0

Return the number of heightfields that currently exist.

Returns

Number of heightfields.

virtual PxU32 getHeightFields(PxHeightField **userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0

Writes the array of heightfield pointers to a user buffer.

Returns the number of pointers written.

The ordering of the heightfields in the array is not specified.

Parameters
  • userBuffer[out] The buffer to receive heightfield pointers.

  • bufferSize[in] The number of heightfield pointers which can be stored in the buffer.

  • startIndex[in] Index of first heightfield pointer to be retrieved.

Returns

The number of heightfield pointers written to userBuffer, this should be less or equal to bufferSize.

virtual PxConvexMesh *createConvexMesh(PxInputStream &stream) = 0

Creates a convex mesh object.

This can then be instanced into PxShape objects.

Parameters

stream[in] The stream to load the convex mesh from.

Returns

The new convex mesh.

virtual PxU32 getNbConvexMeshes() const = 0

Return the number of convex meshes that currently exist.

Returns

Number of convex meshes.

virtual PxU32 getConvexMeshes(PxConvexMesh **userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0

Writes the array of convex mesh pointers to a user buffer.

Returns the number of pointers written.

The ordering of the convex meshes in the array is not specified.

Parameters
  • userBuffer[out] The buffer to receive convex mesh pointers.

  • bufferSize[in] The number of convex mesh pointers which can be stored in the buffer.

  • startIndex[in] Index of first convex mesh pointer to be retrieved.

Returns

The number of convex mesh pointers written to userBuffer, this should be less or equal to bufferSize.

virtual PxBVH *createBVH(PxInputStream &stream) = 0

Creates a bounding volume hierarchy.

See also

PxBVH PxInputStream

Parameters

stream[in] The stream to load the BVH from.

Returns

The new BVH.

inline PxBVH *createBVHStructure(PxInputStream &stream)

Deprecated:

virtual PxU32 getNbBVHs() const = 0

Return the number of bounding volume hierarchies that currently exist.

See also

PxBVH getBVHs()

Returns

Number of bounding volume hierarchies.

inline PxU32 getNbBVHStructures() const

Deprecated:

virtual PxU32 getBVHs(PxBVH **userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0

Writes the array of bounding volume hierarchy pointers to a user buffer.

Returns the number of pointers written.

The ordering of the BVHs in the array is not specified.

See also

getNbBVHs() PxBVH

Parameters
  • userBuffer[out] The buffer to receive BVH pointers.

  • bufferSize[in] The number of BVH pointers which can be stored in the buffer.

  • startIndex[in] Index of first BVH pointer to be retrieved.

Returns

The number of BVH pointers written to userBuffer, this should be less or equal to bufferSize.

inline PxU32 getBVHStructures(PxBVHStructure **userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const

Deprecated:

Scenes

virtual PxScene *createScene(const PxSceneDesc &sceneDesc) = 0

Creates a scene.

Note

Every scene uses a Thread Local Storage slot. This imposes a platform specific limit on the number of scenes that can be created.

Parameters

sceneDesc[in] Scene descriptor. See PxSceneDesc

Returns

The new scene object.

virtual PxU32 getNbScenes() const = 0

Gets number of created scenes.

See also

getScenes()

Returns

The number of scenes created.

virtual PxU32 getScenes(PxScene **userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0

Writes the array of scene pointers to a user buffer.

Returns the number of pointers written.

The ordering of the scene pointers in the array is not specified.

Parameters
  • userBuffer[out] The buffer to receive scene pointers.

  • bufferSize[in] The number of scene pointers which can be stored in the buffer.

  • startIndex[in] Index of first scene pointer to be retrieved.

Returns

The number of scene pointers written to userBuffer, this should be less or equal to bufferSize.

Actors

virtual PxRigidStatic *createRigidStatic(const PxTransform &pose) = 0

Creates a static rigid actor with the specified pose and all other fields initialized to their default values.

See also

PxRigidStatic

Parameters

pose[in] The initial pose of the actor. Must be a valid transform.

virtual PxRigidDynamic *createRigidDynamic(const PxTransform &pose) = 0

Creates a dynamic rigid actor with the specified pose and all other fields initialized to their default values.

See also

PxRigidDynamic

Parameters

pose[in] The initial pose of the actor. Must be a valid transform.

virtual PxPruningStructure *createPruningStructure(PxRigidActor *const *actors, PxU32 nbActors) = 0

Creates a pruning structure from actors.

Note

Every provided actor needs at least one shape with the eSCENE_QUERY_SHAPE flag set.

Note

Both static and dynamic actors can be provided.

Note

It is not allowed to pass in actors which are already part of a scene.

Note

Articulation links cannot be provided.

Parameters
  • actors[in] Array of actors to add to the pruning structure. Must be non NULL.

  • nbActors[in] Number of actors in the array. Must be >0.

Returns

Pruning structure created from given actors, or NULL if any of the actors did not comply with the above requirements.

Shapes

inline PxShape *createShape(const PxGeometry &geometry, const PxMaterial &material, bool isExclusive = false, PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE)

Creates a shape which may be attached to multiple actors.

The shape will be created with a reference count of 1.

See also

PxShape

Note

Shared shapes are not mutable when they are attached to an actor

Parameters
  • geometry[in] The geometry for the shape

  • material[in] The material for the shape

  • isExclusive[in] Whether this shape is exclusive to a single actor or maybe be shared

  • shapeFlags[in] The PxShapeFlags to be set

Returns

The shape

inline PxShape *createShape(const PxGeometry &geometry, const PxFEMSoftBodyMaterial &material, bool isExclusive = false, PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE)

Creates a shape which may be attached to one or more softbody actors.

The shape will be created with a reference count of 1.

See also

PxShape

Note

Shared shapes are not mutable when they are attached to an actor

Parameters
  • geometry[in] The geometry for the shape

  • material[in] The material for the shape

  • isExclusive[in] Whether this shape is exclusive to a single actor or maybe be shared

  • shapeFlags[in] The PxShapeFlags to be set

Returns

The shape

virtual PxShape *createShape(const PxGeometry &geometry, PxMaterial *const *materials, PxU16 materialCount, bool isExclusive = false, PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) = 0

Creates a shape which may be attached to multiple actors.

The shape will be created with a reference count of 1.

See also

PxShape

Note

Shared shapes are not mutable when they are attached to an actor

Note

Shapes created from SDF triangle-mesh geometries do not support more than one material.

Parameters
  • geometry[in] The geometry for the shape

  • materials[in] The materials for the shape

  • materialCount[in] The number of materials

  • isExclusive[in] Whether this shape is exclusive to a single actor or may be shared

  • shapeFlags[in] The PxShapeFlags to be set

Returns

The shape

virtual PxShape *createShape(const PxGeometry &geometry, PxFEMSoftBodyMaterial *const *materials, PxU16 materialCount, bool isExclusive = false, PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) = 0
virtual PxShape *createShape(const PxGeometry &geometry, PxFEMClothMaterial *const *materials, PxU16 materialCount, bool isExclusive = false, PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) = 0
virtual PxU32 getNbShapes() const = 0

Return the number of shapes that currently exist.

See also

getShapes()

Returns

Number of shapes.

virtual PxU32 getShapes(PxShape **userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0

Writes the array of shape pointers to a user buffer.

Returns the number of pointers written.

The ordering of the shapes in the array is not specified.

Parameters
  • userBuffer[out] The buffer to receive shape pointers.

  • bufferSize[in] The number of shape pointers which can be stored in the buffer.

  • startIndex[in] Index of first shape pointer to be retrieved

Returns

The number of shape pointers written to userBuffer, this should be less or equal to bufferSize.

Constraints and Articulations

virtual PxConstraint *createConstraint(PxRigidActor *actor0, PxRigidActor *actor1, PxConstraintConnector &connector, const PxConstraintShaderTable &shaders, PxU32 dataSize) = 0

Creates a constraint shader.

See also

PxConstraint

Note

A constraint shader will get added automatically to the scene the two linked actors belong to. Either, but not both, of actor0 and actor1 may be NULL to denote attachment to the world.

Parameters
  • actor0[in] The first actor

  • actor1[in] The second actor

  • connector[in] The connector object, which the SDK uses to communicate with the infrastructure for the constraint

  • shaders[in] The shader functions for the constraint

  • dataSize[in] The size of the data block for the shader

Returns

The new constraint shader.

virtual PxArticulationReducedCoordinate *createArticulationReducedCoordinate() = 0

Creates a reduced-coordinate articulation with all fields initialized to their default values.

Returns

the new articulation

virtual PxFEMCloth *createFEMCloth(PxCudaContextManager &cudaContextManager) = 0

Creates a FEM-based cloth with all fields initialized to their default values.

See also

PxFEMCloth

Warning

Feature under development, only for internal usage.

Parameters

cudaContextManager[in] The PxCudaContextManager this instance is tied to.

Returns

the new FEM-cloth

virtual PxSoftBody *createSoftBody(PxCudaContextManager &cudaContextManager) = 0

Creates a FEM-based soft body with all fields initialized to their default values.

See also

PxSoftBody

Parameters

cudaContextManager[in] The PxCudaContextManager this instance is tied to.

Returns

the new soft body

virtual PxHairSystem *createHairSystem(PxCudaContextManager &cudaContextManager) = 0

Creates a hair system with all fields initialized to their default values.

See also

PxHairSystem

Warning

Feature under development, only for internal usage.

Parameters

cudaContextManager[in] The PxCudaContextManager this instance is tied to.

Returns

the new hair system

virtual PxPBDParticleSystem *createPBDParticleSystem(PxCudaContextManager &cudaContextManager, PxU32 maxNeighborhood = 96) = 0

Creates a particle system with a position-based dynamics (PBD) solver.

A PBD particle system can be used to simulate particle systems with fluid and granular particles. It also allows simulating cloth using mass-spring constraints and rigid bodies by shape matching the bodies with particles.

Parameters
  • cudaContextManager[in] The PxCudaContextManager this instance is tied to.

  • maxNeighborhood[in] The maximum number of particles considered in neighborhood-based particle interaction calculations (e.g. fluid density constraints).

Returns

the new particle system

virtual PxFLIPParticleSystem *createFLIPParticleSystem(PxCudaContextManager &cudaContextManager) = 0

Creates a particle system with a fluid-implicit particle solver (FLIP).

See also

PxFLIPParticleSystem

Warning

Feature under development, only for internal usage.

Parameters

cudaContextManager[in] The PxCudaContextManager this instance is tied to.

Returns

the new particle system

virtual PxMPMParticleSystem *createMPMParticleSystem(PxCudaContextManager &cudaContextManager) = 0

Creates a particle system with a material-point-method solver (MPM).

A MPM particle system can be used to simulate fluid dynamics and deformable body effects using particles.

See also

PxMPMParticleSystem

Warning

Feature under development, only for internal usage.

Parameters

cudaContextManager[in] The PxCudaContextManager this instance is tied to.

Returns

the new particle system

virtual PxCustomParticleSystem *createCustomParticleSystem(PxCudaContextManager &cudaContextManager, PxU32 maxNeighborhood) = 0

Creates a customizable particle system to simulate effects that are not supported by PhysX natively (e.g.

molecular dynamics).

See also

PxCustomParticleSystem

Warning

Feature under development, only for internal usage.

Parameters
  • cudaContextManager[in] The PxCudaContextManager this instance is tied to.

  • maxNeighborhood[in] The maximum number of particles considered in neighborhood-based particle interaction calculations (e.g. fluid density constraints).

Returns

the new particle system

virtual PxBuffer *createBuffer(PxU64 byteSize, PxBufferType::Enum bufferType, PxCudaContextManager *cudaContextManager) = 0

Create a buffer for reading and writing data across host and device memory spaces.

See also

PxBuffer

Parameters
  • byteSize[in] The size of the buffer in bytes.

  • bufferType[in] The memory space of the buffer.

  • cudaContextManager[in] The PxCudaContextManager this buffer is tied to.

Returns

PxBuffer instance.

virtual PxParticleBuffer *createParticleBuffer(PxU32 maxParticles, PxU32 maxVolumes, PxCudaContextManager *cudaContextManager) = 0

Create particle buffer to simulate fluid/granular material.

See also

PxParticleBuffer

Parameters
  • maxParticles[in] The maximum number of particles in this buffer.

  • maxVolumes[in] The maximum number of volumes in this buffer. See PxParticleVolume.

  • cudaContextManager[in] The PxCudaContextManager this buffer is tied to.

Returns

PxParticleBuffer instance

virtual PxParticleAndDiffuseBuffer *createParticleAndDiffuseBuffer(PxU32 maxParticles, PxU32 maxVolumes, PxU32 maxDiffuseParticles, PxCudaContextManager *cudaContextManager) = 0

Create a particle buffer for fluid dynamics with diffuse particles.

Diffuse particles are used to simulate fluid effects such as foam, spray and bubbles.

Parameters
  • maxParticles[in] The maximum number of particles in this buffer.

  • maxVolumes[in] The maximum number of volumes in this buffer. See PxParticleVolume.

  • maxDiffuseParticles[in] The max number of diffuse particles int this buffer.

  • cudaContextManager[in] The PxCudaContextManager this buffer is tied to.

Returns

PxParticleAndDiffuseBuffer instance

virtual PxParticleClothBuffer *createParticleClothBuffer(PxU32 maxParticles, PxU32 maxNumVolumes, PxU32 maxNumCloths, PxU32 maxNumTriangles, PxU32 maxNumSprings, PxCudaContextManager *cudaContextManager) = 0

Create a particle buffer to simulate particle cloth.

Parameters
  • maxParticles[in] The maximum number of particles in this buffer.

  • maxNumVolumes[in] The maximum number of volumes in this buffer. See PxParticleVolume.

  • maxNumCloths[in] The maximum number of cloths in this buffer. See PxParticleCloth.

  • maxNumTriangles[in] The maximum number of triangles for aerodynamics.

  • maxNumSprings[in] The maximum number of springs to connect particles. See PxParticleSpring.

  • cudaContextManager[in] The PxCudaContextManager this buffer is tied to.

Returns

PxParticleClothBuffer instance

virtual PxParticleRigidBuffer *createParticleRigidBuffer(PxU32 maxParticles, PxU32 maxNumVolumes, PxU32 maxNumRigids, PxCudaContextManager *cudaContextManager) = 0

Create a particle buffer to simulate rigid bodies using shape matching with particles.

Parameters
  • maxParticles[in] The maximum number of particles in this buffer.

  • maxNumVolumes[in] The maximum number of volumes in this buffer. See PxParticleVolume.

  • maxNumRigids[in] The maximum number of rigid bodies this buffer is used to simulate.

  • cudaContextManager[in] The PxCudaContextManager this buffer is tied to.

Returns

PxParticleRigidBuffer instance

Materials

virtual PxMaterial *createMaterial(PxReal staticFriction, PxReal dynamicFriction, PxReal restitution) = 0

Creates a new rigid body material with certain default properties.

See also

PxMaterial

Parameters
  • staticFriction[in] The coefficient of static friction

  • dynamicFriction[in] The coefficient of dynamic friction

  • restitution[in] The coefficient of restitution

Returns

The new rigid body material.

virtual PxU32 getNbMaterials() const = 0

Return the number of rigid body materials that currently exist.

See also

getMaterials()

Returns

Number of rigid body materials.

virtual PxU32 getMaterials(PxMaterial **userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0

Writes the array of rigid body material pointers to a user buffer.

Returns the number of pointers written.

The ordering of the materials in the array is not specified.

Parameters
  • userBuffer[out] The buffer to receive material pointers.

  • bufferSize[in] The number of material pointers which can be stored in the buffer.

  • startIndex[in] Index of first material pointer to be retrieved.

Returns

The number of material pointers written to userBuffer, this should be less or equal to bufferSize.

virtual PxFEMSoftBodyMaterial *createFEMSoftBodyMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction) = 0

Creates a new FEM soft body material with certain default properties.

Parameters
  • youngs[in] The young’s modulus

  • poissons[in] The poissons’s ratio

  • dynamicFriction[in] The dynamic friction coefficient

Returns

The new FEM material.

virtual PxU32 getNbFEMSoftBodyMaterials() const = 0

Return the number of FEM soft body materials that currently exist.

Returns

Number of FEM materials.

virtual PxU32 getFEMSoftBodyMaterials(PxFEMSoftBodyMaterial **userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0

Writes the array of FEM soft body material pointers to a user buffer.

Returns the number of pointers written.

The ordering of the materials in the array is not specified.

Parameters
  • userBuffer[out] The buffer to receive material pointers.

  • bufferSize[in] The number of material pointers which can be stored in the buffer.

  • startIndex[in] Index of first material pointer to be retrieved.

Returns

The number of material pointers written to userBuffer, this should be less or equal to bufferSize.

virtual PxFEMClothMaterial *createFEMClothMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction) = 0

Creates a new FEM cloth material with certain default properties.

Warning

Feature under development, only for internal usage.

Parameters
  • youngs[in] The young’s modulus

  • poissons[in] The poissons’s ratio

  • dynamicFriction[in] The dynamic friction coefficient

Returns

The new FEM material.

virtual PxU32 getNbFEMClothMaterials() const = 0

Return the number of FEM cloth materials that currently exist.

Returns

Number of FEM cloth materials.

virtual PxU32 getFEMClothMaterials(PxFEMClothMaterial **userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0

Writes the array of FEM cloth material pointers to a user buffer.

Returns the number of pointers written.

The ordering of the materials in the array is not specified.

Parameters
  • userBuffer[out] The buffer to receive material pointers.

  • bufferSize[in] The number of material pointers which can be stored in the buffer.

  • startIndex[in] Index of first material pointer to be retrieved.

Returns

The number of material pointers written to userBuffer, this should be less or equal to bufferSize.

virtual PxPBDMaterial *createPBDMaterial(PxReal friction, PxReal damping, PxReal adhesion, PxReal viscosity, PxReal vorticityConfinement, PxReal surfaceTension, PxReal cohesion, PxReal lift, PxReal drag, PxReal cflCoefficient = 1.f, PxReal gravityScale = 1.f) = 0

Creates a new PBD material with certain default properties.

See also

PxPBDMaterial

Parameters
  • friction[in] The friction parameter

  • damping[in] The velocity damping parameter

  • adhesion[in] The adhesion parameter

  • viscosity[in] The viscosity parameter

  • vorticityConfinement[in] The vorticity confinement coefficient

  • surfaceTension[in] The surface tension coefficient

  • cohesion[in] The cohesion parameter

  • lift[in] The lift parameter

  • drag[in] The drag parameter

  • cflCoefficient[in] The Courant-Friedrichs-Lewy(cfl) coefficient

  • gravityScale[in] The gravity scale

Returns

The new PBD material.

virtual PxU32 getNbPBDMaterials() const = 0

Return the number of PBD materials that currently exist.

Returns

Number of PBD materials.

virtual PxU32 getPBDMaterials(PxPBDMaterial **userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0

Writes the array of PBD material pointers to a user buffer.

Returns the number of pointers written.

The ordering of the materials in the array is not specified.

Parameters
  • userBuffer[out] The buffer to receive material pointers.

  • bufferSize[in] The number of material pointers which can be stored in the buffer.

  • startIndex[in] Index of first material pointer to be retrieved.

Returns

The number of material pointers written to userBuffer, this should be less or equal to bufferSize.

virtual PxFLIPMaterial *createFLIPMaterial(PxReal friction, PxReal damping, PxReal adhesion, PxReal viscosity, PxReal gravityScale = 1.f) = 0

Creates a new FLIP material with certain default properties.

See also

PxFLIPMaterial

Warning

Feature under development, only for internal usage.

Parameters
  • friction[in] The friction parameter

  • damping[in] The velocity damping parameter

  • adhesion[in] The maximum velocity magnitude of particles

  • viscosity[in] The viscosity parameter

  • gravityScale[in] The gravity scale

Returns

The new FLIP material.

virtual PxU32 getNbFLIPMaterials() const = 0

Return the number of FLIP materials that currently exist.

Warning

Feature under development, only for internal usage.

Returns

Number of FLIP materials.

virtual PxU32 getFLIPMaterials(PxFLIPMaterial **userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0

Writes the array of FLIP material pointers to a user buffer.

Returns the number of pointers written.

The ordering of the materials in the array is not specified.

Warning

Feature under development, only for internal usage.

Parameters
  • userBuffer[out] The buffer to receive material pointers.

  • bufferSize[in] The number of material pointers which can be stored in the buffer.

  • startIndex[in] Index of first material pointer to be retrieved.

Returns

The number of material pointers written to userBuffer, this should be less or equal to bufferSize.

virtual PxMPMMaterial *createMPMMaterial(PxReal friction, PxReal damping, PxReal adhesion, bool isPlastic, PxReal youngsModulus, PxReal poissons, PxReal hardening, PxReal criticalCompression, PxReal criticalStretch, PxReal tensileDamageSensitivity, PxReal compressiveDamageSensitivity, PxReal attractiveForceResidual, PxReal gravityScale = 1.0f) = 0

Creates a new MPM material with certain default properties.

See also

PxMPMMaterial

Warning

Feature under development, only for internal usage.

Parameters
  • friction[in] The friction parameter

  • damping[in] The velocity damping parameter

  • adhesion[in] The maximum velocity magnitude of particles

  • isPlastic[in] True if plastic

  • youngsModulus[in] The Young’s modulus

  • poissons[in] The Poissons’s ratio

  • hardening[in] The hardening parameter

  • criticalCompression[in] The critical compression parameter

  • criticalStretch[in] The critical stretch parameter

  • tensileDamageSensitivity[in] The tensile damage sensitivity parameter

  • compressiveDamageSensitivity[in] The compressive damage sensitivity parameter

  • attractiveForceResidual[in] The attractive force residual parameter

  • gravityScale[in] The gravity scale

Returns

The new MPM material.

virtual PxU32 getNbMPMMaterials() const = 0

Return the number of MPM materials that currently exist.

Warning

Feature under development, only for internal usage.

Returns

Number of MPM materials.

virtual PxU32 getMPMMaterials(PxMPMMaterial **userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0

Writes the array of MPM material pointers to a user buffer.

Returns the number of pointers written.

The ordering of the materials in the array is not specified.

Warning

Feature under development, only for internal usage.

Parameters
  • userBuffer[out] The buffer to receive material pointers.

  • bufferSize[in] The number of material pointers which can be stored in the buffer.

  • startIndex[in] Index of first material pointer to be retrieved.

Returns

The number of material pointers written to userBuffer, this should be less or equal to bufferSize.

virtual PxCustomMaterial *createCustomMaterial(void *gpuBuffer) = 0

Creates a new material for custom particle systems.

Warning

Feature under development, only for internal usage.

Parameters

gpuBuffer[in] A pointer to a GPU buffer containing material parameters.

Returns

the new material.

virtual PxU32 getNbCustomMaterials() const = 0

Return the number of custom materials that currently exist.

Warning

Feature under development, only for internal usage.

Returns

Number of custom materials.

virtual PxU32 getCustomMaterials(PxCustomMaterial **userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0

Writes the array of custom material pointers to a user buffer.

Returns the number of pointers written.

The ordering of the materials in the array is not specified.

Warning

Feature under development, only for internal usage.

Parameters
  • userBuffer[out] The buffer to receive material pointers.

  • bufferSize[in] The number of material pointers which can be stored in the buffer.

  • startIndex[in] Index of first material pointer to be retrieved.

Returns

The number of material pointers written to userBuffer, this should be less or equal to bufferSize.

Deletion Listeners

virtual void registerDeletionListener(PxDeletionListener &observer, const PxDeletionEventFlags &deletionEvents, bool restrictedObjectSet = false) = 0

Register a deletion listener.

Listeners will be called whenever an object is deleted.

It is illegal to register or unregister a deletion listener while deletions are being processed.

Note

By default a registered listener will receive events from all objects. Set the restrictedObjectSet parameter to true on registration and use registerDeletionListenerObjects to restrict the received events to specific objects.

Note

The deletion events are only supported on core PhysX objects. In general, objects in extension modules do not provide this functionality, however, in the case of PxJoint objects, the underlying PxConstraint will send the events.

Parameters
  • observer[in] Observer object to send notifications to.

  • deletionEvents[in] The deletion event types to get notified of.

  • restrictedObjectSet[in] If false, the deletion listener will get events from all objects, else the objects to receive events from have to be specified explicitly through registerDeletionListenerObjects.

virtual void unregisterDeletionListener(PxDeletionListener &observer) = 0

Unregister a deletion listener.

It is illegal to register or unregister a deletion listener while deletions are being processed.

Parameters

observer[in] Observer object to stop sending notifications to.

virtual void registerDeletionListenerObjects(PxDeletionListener &observer, const PxBase *const *observables, PxU32 observableCount) = 0

Register specific objects for deletion events.

This method allows for a deletion listener to limit deletion events to specific objects only.

Note

It is illegal to register or unregister objects while deletions are being processed.

Note

The deletion listener has to be registered through registerDeletionListener() and configured to support restricted object sets prior to this method being used.

Parameters
  • observer[in] Observer object to send notifications to.

  • observables[in] List of objects for which to receive deletion events. Only PhysX core objects are supported. In the case of PxJoint objects, the underlying PxConstraint can be used to get the events.

  • observableCount[in] Size of the observables list.

virtual void unregisterDeletionListenerObjects(PxDeletionListener &observer, const PxBase *const *observables, PxU32 observableCount) = 0

Unregister specific objects for deletion events.

This method allows to clear previously registered objects for a deletion listener (see registerDeletionListenerObjects()).

Note

It is illegal to register or unregister objects while deletions are being processed.

Note

The deletion listener has to be registered through registerDeletionListener() and configured to support restricted object sets prior to this method being used.

Parameters
  • observer[in] Observer object to stop sending notifications to.

  • observables[in] List of objects for which to not receive deletion events anymore.

  • observableCount[in] Size of the observables list.

virtual PxInsertionCallback &getPhysicsInsertionCallback() = 0

Gets PxPhysics object insertion interface.

The insertion interface is needed for PxCreateTriangleMesh, PxCooking::createTriangleMesh etc., this allows runtime mesh creation.

See also

PxCreateTriangleMesh PxCreateHeightField PxCreateTetrahedronMesh PxCreateBVH PxCooking::createTriangleMesh PxCooking::createHeightfield PxCooking::createTetrahedronMesh PxCooking::createBVH