PxControllerManager Class Referenceabstract

Manages an array of character controllers. More...

#include <PxControllerManager.h>

Public Member Functions

virtual void release ()=0
 Releases the controller manager. More...
 
virtual PxScenegetScene () const =0
 Returns the scene the manager is adding the controllers to. More...
 
virtual PxU32 getNbControllers () const =0
 Returns the number of controllers that are being managed. More...
 
virtual PxControllergetController (PxU32 index)=0
 Retrieve one of the controllers in the manager. More...
 
virtual PxControllercreateController (const PxControllerDesc &desc)=0
 Creates a new character controller. More...
 
virtual void purgeControllers ()=0
 Releases all the controllers that are being managed. More...
 
virtual PxRenderBuffergetRenderBuffer ()=0
 Retrieves debug data. More...
 
virtual void setDebugRenderingFlags (PxControllerDebugRenderFlags flags)=0
 Sets debug rendering flags. More...
 
virtual PxU32 getNbObstacleContexts () const =0
 Returns the number of obstacle contexts that are being managed. More...
 
virtual PxObstacleContextgetObstacleContext (PxU32 index)=0
 Retrieve one of the obstacle contexts in the manager. More...
 
virtual PxObstacleContextcreateObstacleContext ()=0
 Creates an obstacle context. More...
 
virtual void computeInteractions (PxF32 elapsedTime, PxControllerFilterCallback *cctFilterCb=NULL)=0
 Computes character-character interactions. More...
 
virtual void setTessellation (bool flag, float maxEdgeLength)=0
 Enables or disables runtime tessellation. More...
 
virtual void setOverlapRecoveryModule (bool flag)=0
 Enables or disables the overlap recovery module. More...
 
virtual void setPreciseSweeps (bool flag)=0
 Enables or disables the precise sweeps. More...
 
virtual void setPreventVerticalSlidingAgainstCeiling (bool flag)=0
 Enables or disables vertical sliding against ceilings. More...
 
virtual void shiftOrigin (const PxVec3 &shift)=0
 Shift the origin of the character controllers and obstacle objects by the specified vector. More...
 

Protected Member Functions

 PxControllerManager ()
 
virtual ~PxControllerManager ()
 

Detailed Description

Manages an array of character controllers.

See also
PxController PxBoxController PxCapsuleController

Constructor & Destructor Documentation

◆ PxControllerManager()

PxControllerManager::PxControllerManager ( )
inlineprotected

◆ ~PxControllerManager()

virtual PxControllerManager::~PxControllerManager ( )
inlineprotectedvirtual

Member Function Documentation

◆ computeInteractions()

virtual void PxControllerManager::computeInteractions ( PxF32  elapsedTime,
PxControllerFilterCallback cctFilterCb = NULL 
)
pure virtual

Computes character-character interactions.

This function is an optional helper to properly resolve interactions between characters, in case they overlap (which can happen for gameplay reasons, etc).

You should call this once per frame, before your PxController::move() calls. The function will not move the characters directly, but it will compute overlap information for each character that will be used in the next move() call.

You need to provide a proper time value here so that interactions are resolved in a way that do not depend on the framerate.

If you only have one character in the scene, or if you can guarantee your characters will never overlap, then you do not need to call this function.

Note
Releasing the manager will automatically release all the associated obstacle contexts.
Parameters
[in]elapsedTimeElapsed time since last call
[in]cctFilterCbFiltering callback for CCT-vs-CCT interactions

◆ createController()

virtual PxController* PxControllerManager::createController ( const PxControllerDesc desc)
pure virtual

Creates a new character controller.

Parameters
[in]descThe controllers descriptor
Returns
The new controller
See also
PxController PxController.release() PxControllerDesc

◆ createObstacleContext()

virtual PxObstacleContext* PxControllerManager::createObstacleContext ( )
pure virtual

Creates an obstacle context.

Returns
New obstacle context
See also
PxObstacleContext

◆ getController()

virtual PxController* PxControllerManager::getController ( PxU32  index)
pure virtual

Retrieve one of the controllers in the manager.

Parameters
indexthe index of the controller to return
Returns
The controller with the specified index.

◆ getNbControllers()

virtual PxU32 PxControllerManager::getNbControllers ( ) const
pure virtual

Returns the number of controllers that are being managed.

Returns
The number of controllers.

◆ getNbObstacleContexts()

virtual PxU32 PxControllerManager::getNbObstacleContexts ( ) const
pure virtual

Returns the number of obstacle contexts that are being managed.

Returns
The number of obstacle contexts.

◆ getObstacleContext()

virtual PxObstacleContext* PxControllerManager::getObstacleContext ( PxU32  index)
pure virtual

Retrieve one of the obstacle contexts in the manager.

Parameters
indexThe index of the obstacle context to retrieve.
Returns
The obstacle context with the specified index.

◆ getRenderBuffer()

virtual PxRenderBuffer& PxControllerManager::getRenderBuffer ( )
pure virtual

Retrieves debug data.

Returns
The render buffer filled with debug-render data
See also
PxControllerManager.setDebugRenderingFlags()

◆ getScene()

virtual PxScene& PxControllerManager::getScene ( ) const
pure virtual

Returns the scene the manager is adding the controllers to.

Returns
The associated physics scene.

◆ purgeControllers()

virtual void PxControllerManager::purgeControllers ( )
pure virtual

Releases all the controllers that are being managed.

◆ release()

virtual void PxControllerManager::release ( )
pure virtual

Releases the controller manager.

Note
This will release all associated controllers and obstacle contexts.
This function is required to be called to release foundation usage.

◆ setDebugRenderingFlags()

virtual void PxControllerManager::setDebugRenderingFlags ( PxControllerDebugRenderFlags  flags)
pure virtual

Sets debug rendering flags.

Parameters
[in]flagsThe debug rendering flags (combination of PxControllerDebugRenderFlags)
See also
PxControllerManager.getRenderBuffer() PxControllerDebugRenderFlags

◆ setOverlapRecoveryModule()

virtual void PxControllerManager::setOverlapRecoveryModule ( bool  flag)
pure virtual

Enables or disables the overlap recovery module.

The overlap recovery module can be used to depenetrate CCTs from static objects when an overlap is detected. This can happen in three main cases:

  • when the CCT is directly spawned or teleported in another object
  • when the CCT algorithm fails due to limited FPU accuracy
  • when the "up vector" is modified, making the rotated CCT shape overlap surrounding objects

When activated, the CCT module will automatically try to resolve the penetration, and move the CCT to a safe place where it does not overlap other objects anymore. This only concerns static objects, dynamic objects are ignored by the recovery module.

When the recovery module is not activated, it is possible for the CCTs to go through static objects. By default, the recovery module is enabled.

The recovery module currently works with all geometries except heightfields.

Parameters
[in]flagTrue/false to enable/disable overlap recovery module.

◆ setPreciseSweeps()

virtual void PxControllerManager::setPreciseSweeps ( bool  flag)
pure virtual

Enables or disables the precise sweeps.

Precise sweeps are more accurate, but also potentially slower than regular sweeps.

By default, precise sweeps are enabled.

Parameters
[in]flagTrue/false to enable/disable precise sweeps.

◆ setPreventVerticalSlidingAgainstCeiling()

virtual void PxControllerManager::setPreventVerticalSlidingAgainstCeiling ( bool  flag)
pure virtual

Enables or disables vertical sliding against ceilings.

Geometry is seen as "ceilings" when the following condition is met:

dot product(contact normal, up direction)<0.0f

This flag controls whether characters should slide vertically along the geometry in that case.

By default, sliding is allowed.

Parameters
[in]flagTrue/false to enable/disable sliding.

◆ setTessellation()

virtual void PxControllerManager::setTessellation ( bool  flag,
float  maxEdgeLength 
)
pure virtual

Enables or disables runtime tessellation.

Large triangles can create accuracy issues in the sweep code, which in turn can lead to characters not sliding smoothly against geometries, or even penetrating them. This feature allows one to reduce those issues by tessellating large triangles at runtime, before performing sweeps against them. The amount of tessellation is controlled by the 'maxEdgeLength' parameter. Any triangle with at least one edge length greater than the maxEdgeLength will get recursively tessellated, until resulting triangles are small enough.

This features only applies to triangle meshes, convex meshes, heightfields and boxes.

Parameters
[in]flagTrue/false to enable/disable runtime tessellation.
[in]maxEdgeLengthMax edge length allowed before tessellation kicks in.

◆ shiftOrigin()

virtual void PxControllerManager::shiftOrigin ( const PxVec3 shift)
pure virtual

Shift the origin of the character controllers and obstacle objects by the specified vector.

The positions of all character controllers, obstacle objects and the corresponding data structures will get adjusted to reflect the shifted origin location (the shift vector will get subtracted from all character controller and obstacle object positions).

Note
It is the user's responsibility to keep track of the summed total origin shift and adjust all input/output to/from PhysXCharacterKinematic accordingly.
This call will not automatically shift the PhysX scene and its objects. You need to call PxScene::shiftOrigin() seperately to keep the systems in sync.
Parameters
[in]shiftTranslation vector to shift the origin by.

The documentation for this class was generated from the following file: