PhysX SDK 3.2 API Reference: PxShape Class Reference

PhysX SDK 3.2 API

PxShape Class Reference
[Physics]

Abstract class for collision shapes. More...

#include <PxShape.h>

Inheritance diagram for PxShape:
Collaboration diagram for PxShape:

List of all members.


Public Member Functions

virtual void release ()=0
 Deletes the shape.
virtual PxGeometryType::Enum getGeometryType () const =0
 Get the geometry type of the shape.
virtual void setGeometry (const PxGeometry &geometry)=0
 Adjust the geometry of the shape.
virtual PxGeometryHolder getGeometry () const =0
 Retrieve the geometry from the shape in a PxGeometryHolder wrapper class.
virtual bool getBoxGeometry (PxBoxGeometry &geometry) const =0
 Fetch the geometry of the shape.
virtual bool getSphereGeometry (PxSphereGeometry &geometry) const =0
 Fetch the geometry of the shape.
virtual bool getCapsuleGeometry (PxCapsuleGeometry &geometry) const =0
 Fetch the geometry of the shape.
virtual bool getPlaneGeometry (PxPlaneGeometry &geometry) const =0
 Fetch the geometry of the shape.
virtual bool getConvexMeshGeometry (PxConvexMeshGeometry &geometry) const =0
 Fetch the geometry of the shape.
virtual bool getTriangleMeshGeometry (PxTriangleMeshGeometry &geometry) const =0
 Fetch the geometry of the shape.
virtual bool getHeightFieldGeometry (PxHeightFieldGeometry &geometry) const =0
 Fetch the geometry of the shape.
virtual PxRigidActorgetActor () const =0
 Retrieves the actor which this shape is associated with.
virtual PxBounds3 getWorldBounds () const =0
 Retrieves the axis aligned bounding box enclosing the shape.
virtual void setMaterials (PxMaterial *const *materials, PxU32 materialCount)=0
 Assigns material(s) to the shape.
virtual PxU32 getNbMaterials () const =0
 Returns the number of materials assigned to the shape.
virtual PxU32 getMaterials (PxMaterial **userBuffer, PxU32 bufferSize) const =0
 Retrieve all the material pointers associated with the shape.
virtual PxMaterialgetMaterialFromInternalFaceIndex (PxU32 faceIndex) const =0
 Retrieve material from given triangle index.
virtual void setContactOffset (PxReal contactOffset)=0
 Sets the contact offset.
virtual PxReal getContactOffset () const =0
 Retrieves the contact offset.
virtual void setRestOffset (PxReal restOffset)=0
 Sets the rest offset.
virtual PxReal getRestOffset () const =0
 Retrieves the rest offset.
virtual void setFlag (PxShapeFlag::Enum flag, bool value)=0
 Sets shape flags.
virtual void setFlags (PxShapeFlags inFlags)=0
 Sets shape flags.
virtual PxShapeFlags getFlags () const =0
 Retrieves shape flags.
virtual void setName (const char *name)=0
 Sets a name string for the object that can be retrieved with getName().
virtual const char * getName () const =0
 retrieves the name string set with setName().
virtual PxU32 raycast (const PxVec3 &rayOrigin, const PxVec3 &rayDir, PxReal maxDist, PxSceneQueryFlags hintFlags, PxU32 maxHits, PxRaycastHit *rayHits, bool firstHit, const PxTransform *shapePose=NULL) const =0
 Raycast test against the shape.
virtual bool overlap (const PxGeometry &otherGeom, const PxTransform &otherGeomPose, const PxTransform *shapePose=NULL) const =0
 Test overlap between the shape and a geometry object.
virtual bool sweep (const PxVec3 &unitDir, const PxReal distance, const PxGeometry &otherGeom, const PxTransform &otherGeomPose, PxSweepHit &sweepHit, PxSceneQueryFlags hintFlags, const PxTransform *shapePose=NULL) const =0
 Sweep a geometry object against the shape.
virtual const char * getConcreteTypeName () const
 returns string name of dynamic type.
Pose Manipulation
virtual void setLocalPose (const PxTransform &pose)=0
 Sets the pose of the shape in actor space, i.e. relative to the actor they are owned by.
virtual PxTransform getLocalPose () const =0
 Retrieves the pose of the shape in actor space, i.e. relative to the actor they are owned by.
Collision Filtering
virtual void setSimulationFilterData (const PxFilterData &data)=0
 Sets the user definable collision filter data.
virtual PxFilterData getSimulationFilterData () const =0
 Retrieves the shape's collision filter data.
virtual void resetFiltering ()=0
 Marks the object to reset interactions and re-run collision filters in the next simulation step.
virtual void setQueryFilterData (const PxFilterData &data)=0
 Sets the user definable query filter data.
virtual PxFilterData getQueryFilterData () const =0
 Retrieves the shape's Query filter data.

Public Attributes

void * userData
 user can assign this to whatever, usually to create a 1:1 relationship with a user object.

Protected Member Functions

 PxShape (PxRefResolver &v)
PX_INLINE PxShape ()
virtual ~PxShape ()
virtual bool isKindOf (const char *name) const

Detailed Description

Abstract class for collision shapes.

An instance can be created by calling the createShape() method of the PxRigidActor class, or by adding the shape descriptors into the PxRigidActorDesc class before creating the actor.

Visualizations

The NVIDIA PhysX SDK users guide describes which shape geometries can collide with each other (direct link: users guide)

See also:
PxRigidActor.createShape() PxBoxGeometry PxSphereGeometry PxCapsuleGeometry PxPlaneGeometry PxConvexMeshGeometry PxTriangleMeshGeometry PxHeightFieldGeometry

Constructor & Destructor Documentation

PxShape::PxShape ( PxRefResolver v  )  [inline, protected]

PX_INLINE PxShape::PxShape (  )  [inline, protected]

virtual PxShape::~PxShape (  )  [inline, protected, virtual]


Member Function Documentation

virtual PxRigidActor& PxShape::getActor (  )  const [pure virtual]

Retrieves the actor which this shape is associated with.

Returns:
The actor this shape is associated with.
See also:
PxRigidStatic, PxRigidDynamic, PxArticulationLink

Referenced by PxShapeExt::getGlobalPose().

virtual bool PxShape::getBoxGeometry ( PxBoxGeometry geometry  )  const [pure virtual]

Fetch the geometry of the shape.

Note:
If the type of geometry to extract does not match the geometry type of the shape then the method will return false and the passed in geometry descriptor is not modified.
Parameters:
[in] geometry The descriptor to save the shape's geometry data to.
Returns:
True on success else false
See also:
PxGeometry PxGeometryType getGeometryType()

virtual bool PxShape::getCapsuleGeometry ( PxCapsuleGeometry geometry  )  const [pure virtual]

Fetch the geometry of the shape.

Note:
If the type of geometry to extract does not match the geometry type of the shape then the method will return false and the passed in geometry descriptor is not modified.
Parameters:
[in] geometry The descriptor to save the shape's geometry data to.
Returns:
True on success else false
See also:
PxGeometry PxGeometryType getGeometryType()

virtual const char* PxShape::getConcreteTypeName (  )  const [inline, virtual]

returns string name of dynamic type.

Returns:
class name of most derived type of this object.

Reimplemented from PxSerializable.

virtual PxReal PxShape::getContactOffset (  )  const [pure virtual]

Retrieves the contact offset.

Returns:
The contact offset of the shape.
See also:
setContactOffset()

virtual bool PxShape::getConvexMeshGeometry ( PxConvexMeshGeometry geometry  )  const [pure virtual]

Fetch the geometry of the shape.

Note:
If the type of geometry to extract does not match the geometry type of the shape then the method will return false and the passed in geometry descriptor is not modified.
Parameters:
[in] geometry The descriptor to save the shape's geometry data to.
Returns:
True on success else false
See also:
PxGeometry PxGeometryType getGeometryType()

virtual PxShapeFlags PxShape::getFlags (  )  const [pure virtual]

Retrieves shape flags.

Returns:
The values of the shape flags.
See also:
PxShapeFlag setFlag()

virtual PxGeometryHolder PxShape::getGeometry (  )  const [pure virtual]

Retrieve the geometry from the shape in a PxGeometryHolder wrapper class.

Returns:
a PxGeometryHolder object containing the geometry;
See also:
PxGeometry PxGeometryType getGeometryType() setGeometry()

virtual PxGeometryType::Enum PxShape::getGeometryType (  )  const [pure virtual]

Get the geometry type of the shape.

Returns:
Type of shape geometry.
See also:
PxGeometryType

virtual bool PxShape::getHeightFieldGeometry ( PxHeightFieldGeometry geometry  )  const [pure virtual]

Fetch the geometry of the shape.

Note:
If the type of geometry to extract does not match the geometry type of the shape then the method will return false and the passed in geometry descriptor is not modified.
Parameters:
[in] geometry The descriptor to save the shape's geometry data to.
Returns:
True on success else false
See also:
PxGeometry PxGeometryType getGeometryType()

virtual PxTransform PxShape::getLocalPose (  )  const [pure virtual]

Retrieves the pose of the shape in actor space, i.e. relative to the actor they are owned by.

This transformation is identity by default.

Returns:
Pose of shape relative to the actor's frame.
See also:
setLocalPose()

Referenced by PxShapeExt::getGlobalPose().

virtual PxMaterial* PxShape::getMaterialFromInternalFaceIndex ( PxU32  faceIndex  )  const [pure virtual]

Retrieve material from given triangle index.

The input index is the internal triangle index as used inside the SDK. This is the index returned to users by various SDK functions such as raycasts.

This function is only useful for triangle meshes or heightfields, which have per-triangle materials. For other shapes the function returns the single material associated with the shape, regardless of the index.

Parameters:
[in] faceIndex The internal triangle index whose material you want to retrieve.
Returns:
Material from input triangle
See also:
PxMaterial getNbMaterials() PxMaterial::release()

virtual PxU32 PxShape::getMaterials ( PxMaterial **  userBuffer,
PxU32  bufferSize 
) const [pure virtual]

Retrieve all the material pointers associated with the shape.

You can retrieve the number of material pointers by calling getNbMaterials()

Note: Removing materials with PxMaterial::release() will invalidate the pointer of the released material.

Parameters:
[out] userBuffer The buffer to store the material pointers.
[in] bufferSize Size of provided user buffer.
Returns:
Number of material pointers written to the buffer.
See also:
PxMaterial getNbMaterials() PxMaterial::release()

virtual const char* PxShape::getName (  )  const [pure virtual]

retrieves the name string set with setName().

Returns:
The name associated with the shape.
See also:
setName()

virtual PxU32 PxShape::getNbMaterials (  )  const [pure virtual]

Returns the number of materials assigned to the shape.

You can use getMaterials() to retrieve the material pointers.

Returns:
Number of materials associated with this shape.
See also:
PxMaterial getMaterials()

virtual bool PxShape::getPlaneGeometry ( PxPlaneGeometry geometry  )  const [pure virtual]

Fetch the geometry of the shape.

Note:
If the type of geometry to extract does not match the geometry type of the shape then the method will return false and the passed in geometry descriptor is not modified.
Parameters:
[in] geometry The descriptor to save the shape's geometry data to.
Returns:
True on success else false
See also:
PxGeometry PxGeometryType getGeometryType()

virtual PxFilterData PxShape::getQueryFilterData (  )  const [pure virtual]

Retrieves the shape's Query filter data.

See also:
setQueryFilterData()

virtual PxReal PxShape::getRestOffset (  )  const [pure virtual]

Retrieves the rest offset.

Returns:
The rest offset of the shape.
See also:
setRestOffset()

virtual PxFilterData PxShape::getSimulationFilterData (  )  const [pure virtual]

Retrieves the shape's collision filter data.

See also:
setSimulationFilterData()

virtual bool PxShape::getSphereGeometry ( PxSphereGeometry geometry  )  const [pure virtual]

Fetch the geometry of the shape.

Note:
If the type of geometry to extract does not match the geometry type of the shape then the method will return false and the passed in geometry descriptor is not modified.
Parameters:
[in] geometry The descriptor to save the shape's geometry data to.
Returns:
True on success else false
See also:
PxGeometry PxGeometryType getGeometryType()

virtual bool PxShape::getTriangleMeshGeometry ( PxTriangleMeshGeometry geometry  )  const [pure virtual]

Fetch the geometry of the shape.

Note:
If the type of geometry to extract does not match the geometry type of the shape then the method will return false and the passed in geometry descriptor is not modified.
Parameters:
[in] geometry The descriptor to save the shape's geometry data to.
Returns:
True on success else false
See also:
PxGeometry PxGeometryType getGeometryType()

virtual PxBounds3 PxShape::getWorldBounds (  )  const [pure virtual]

Retrieves the axis aligned bounding box enclosing the shape.

Returns:
The shape's bounding box.
See also:
PxBounds3

virtual bool PxShape::isKindOf ( const char *  name  )  const [inline, protected, virtual]

Reimplemented from PxSerializable.

References PxSerializable::isKindOf().

virtual bool PxShape::overlap ( const PxGeometry otherGeom,
const PxTransform otherGeomPose,
const PxTransform shapePose = NULL 
) const [pure virtual]

Test overlap between the shape and a geometry object.

Parameters:
[in] otherGeom The other geometry object to test overlap with
[in] otherGeomPose Pose of the other geometry object
[in] shapePose Optional pose for the PxShape object. If NULL, the shape's global pose is used.
Returns:
True if the shape overlaps the geometry object
See also:
PxGeometry PxTransform

virtual PxU32 PxShape::raycast ( const PxVec3 rayOrigin,
const PxVec3 rayDir,
PxReal  maxDist,
PxSceneQueryFlags  hintFlags,
PxU32  maxHits,
PxRaycastHit rayHits,
bool  firstHit,
const PxTransform shapePose = NULL 
) const [pure virtual]

Raycast test against the shape.

Parameters:
[in] rayOrigin The origin of the ray to test the geometry object against
[in] rayDir The direction of the ray to test the geometry object against
[in] maxDist Maximum ray length
[in] hintFlags Specification of the kind of information to retrieve on hit. Combination of PxSceneQueryFlag flags
[in] maxHits max number of returned hits = size of 'rayHits' buffer
[out] rayHits Raycast hits information
[in] firstHit Set to false if the closest hit point should be computed, else the query aborts as soon as the first valid hit point is found.
[in] shapePose Optional pose for the PxShape object. If NULL, the shape's global pose is used.
Returns:
Number of hits between the ray and the shape
See also:
RaycastHit PxTransform

virtual void PxShape::release (  )  [pure virtual]

Deletes the shape.

Do not keep a reference to the deleted instance.

For static rigid actors it is not possible to release all shapes associated with the actor. An attempt to remove the last shape will be ignored.

See also:
PxRigidActor::createShape()

virtual void PxShape::resetFiltering (  )  [pure virtual]

Marks the object to reset interactions and re-run collision filters in the next simulation step.

This call forces the object to remove all existing collision interactions, to search anew for existing contact pairs and to run the collision filters again for found collision pairs.

Note:
All persistent state of existing interactions will be lost and can not be retrieved even if the same collison pair is found again in the next step. This will mean, for example, that you will not get notified about persistent contact for such an interaction (see PxPairFlag::eNOTIFY_TOUCH_PERSISTS), the contact pair will be interpreted as newly found instead.

Lost touch contact reports will be sent for every collision pair which includes this shape, if they have been requested through PxPairFlag::eNOTIFY_TOUCH_LOST or PxPairFlag::eNOTIFY_THRESHOLD_FORCE_LOST.

This is an expensive operation, don't use it if you don't have to.

Can be used to retrieve collision pairs that were killed by the collision filters (see PxFilterFlag::eKILL)

Sleeping: Does wake up the actor.

See also:
PxSimulationFilterShader PxSimulationFilterCallback

virtual void PxShape::setContactOffset ( PxReal  contactOffset  )  [pure virtual]

Sets the contact offset.

Shapes whose distance is less than the sum of their contactOffset values will generate contacts. The contact offset must be positive and greater than the rest offset. Having a contactOffset greater than than the restOffset allows the collision detection system to predictively enforce the contact constraint even when the objects are slightly separated. This prevents jitter that would occur if the constraint were enforced only when shapes were within the rest distance.

Default: 0.02f * PxTolerancesScale::length

Sleeping: Does NOT wake the associated actor up automatically.

Parameters:
[in] contactOffset Range: (maximum(0,restOffset),inf)
See also:
getContactOffset PxTolerancesScale setRestOffset

virtual void PxShape::setFlag ( PxShapeFlag::Enum  flag,
bool  value 
) [pure virtual]

Sets shape flags.

Note:
At least one of the following flags has to remain set: PxShapeFlag::eSIMULATION_SHAPE, PxShapeFlag::eTRIGGER_SHAPE, PxShapeFlag::eSCENE_QUERY_SHAPE
Sleeping: Does NOT wake the associated actor up automatically.

Parameters:
[in] flag The shape flag to enable/disable. See PxShapeFlag.
[in] value True to set the flag. False to clear the flag specified in flag.
Default: PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSIMULATION_SHAPE | PxShapeFlag::eSCENE_QUERY_SHAPE

See also:
PxShapeFlag getFlags()

virtual void PxShape::setFlags ( PxShapeFlags  inFlags  )  [pure virtual]

Sets shape flags.

See also:
PxShapeFlag getFlags()

virtual void PxShape::setGeometry ( const PxGeometry geometry  )  [pure virtual]

Adjust the geometry of the shape.

Note:
The type of the passed in geometry must match the geometry type of the shape. It is not allowed to change the geometry type of a shape.
Parameters:
[in] geometry New geometry of the shape.
See also:
PxGeometry PxGeometryType getGeometryType()

virtual void PxShape::setLocalPose ( const PxTransform pose  )  [pure virtual]

Sets the pose of the shape in actor space, i.e. relative to the actor they are owned by.

This transformation is identity by default.

Sleeping: Does NOT wake the associated actor up automatically.

Note: Does not automatically update the inertia properties of the owning actor (if applicable); use the PhysX extensions method PxRigidBodyExt::updateMassAndInertia() to do this.

Default: the identity transform

Parameters:
[in] pose The new transform from the actor frame to the shape frame. Range: rigid body transform
See also:
getLocalPose()

virtual void PxShape::setMaterials ( PxMaterial *const *  materials,
PxU32  materialCount 
) [pure virtual]

Assigns material(s) to the shape.

Sleeping: Does NOT wake the associated actor up automatically.

Parameters:
[in] materials List of material pointers to assign to the shape. See PxMaterial
[in] materialCount The number of materials provided.
See also:
PxPhysics.createMaterial() getMaterials()

virtual void PxShape::setName ( const char *  name  )  [pure virtual]

Sets a name string for the object that can be retrieved with getName().

This is for debugging and is not used by the SDK. The string is not copied by the SDK, only the pointer is stored.

Default: NULL

Parameters:
[in] name The name string to set the objects name to.
See also:
getName()

virtual void PxShape::setQueryFilterData ( const PxFilterData data  )  [pure virtual]

Sets the user definable query filter data.

Default: (0,0,0,0)

See also:
getQueryFilterData()

virtual void PxShape::setRestOffset ( PxReal  restOffset  )  [pure virtual]

Sets the rest offset.

Two shapes will come to rest at a distance equal to the sum of their restOffset values. If the restOffset is 0, they should converge to touching exactly. Having a restOffset greater than zero is useful to have objects slide smoothly, so that they do not get hung up on irregularities of each others' surfaces.

Default: 0.0f

Sleeping: Does NOT wake the associated actor up automatically.

Parameters:
[in] restOffset Range: (-inf,contactOffset)
See also:
getRestOffset setContactOffset

virtual void PxShape::setSimulationFilterData ( const PxFilterData data  )  [pure virtual]

Sets the user definable collision filter data.

Sleeping: Does wake up the actor if the filter data change causes a formerly suppressed collision pair to be enabled.

Default: (0,0,0,0)

See also:
getSimulationFilterData()

virtual bool PxShape::sweep ( const PxVec3 unitDir,
const PxReal  distance,
const PxGeometry otherGeom,
const PxTransform otherGeomPose,
PxSweepHit sweepHit,
PxSceneQueryFlags  hintFlags,
const PxTransform shapePose = NULL 
) const [pure virtual]

Sweep a geometry object against the shape.

Currently only box, sphere, capsule and convex mesh shapes are supported, i.e. the swept geometry object must be one of those types.

Parameters:
[in] unitDir Normalized direction along which the geometry object should be swept.
[in] distance Sweep distance. Needs to be larger than 0.
[in] otherGeom The geometry object to sweep against the shape
[in] otherGeomPose Pose of the geometry object
[out] sweepHit The sweep hit information. Only valid if this method returns true.
[in] hintFlags Specification of the kind of information to retrieve on hit. Combination of PxSceneQueryFlag flags
[in] shapePose Optional pose for the PxShape object. If NULL, the shape's global pose is used.
Returns:
True if the swept geometry object hits the shape
See also:
PxGeometry PxTransform PxSweepHit


Member Data Documentation

user can assign this to whatever, usually to create a 1:1 relationship with a user object.


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



Copyright © 2008-2012 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com