Public Member Functions | Public Attributes | Protected Member Functions | List of all members
PxShape Class Referenceabstract

Abstract class for collision shapes. More...

#include <PxShape.h>

Inheritance diagram for PxShape:
Inheritance graph
[legend]
Collaboration diagram for PxShape:
Collaboration graph
[legend]

Public Member Functions

virtual void release ()=0
 Decrements the reference count of a shape and releases it if the new reference count is zero. More...
 
virtual PxGeometryType::Enum getGeometryType () const =0
 Get the geometry type of the shape. More...
 
virtual void setGeometry (const PxGeometry &geometry)=0
 Adjust the geometry of the shape. More...
 
virtual PxGeometryHolder getGeometry () const =0
 Retrieve the geometry from the shape in a PxGeometryHolder wrapper class. More...
 
virtual bool getBoxGeometry (PxBoxGeometry &geometry) const =0
 Fetch the geometry of the shape. More...
 
virtual bool getSphereGeometry (PxSphereGeometry &geometry) const =0
 Fetch the geometry of the shape. More...
 
virtual bool getCapsuleGeometry (PxCapsuleGeometry &geometry) const =0
 Fetch the geometry of the shape. More...
 
virtual bool getPlaneGeometry (PxPlaneGeometry &geometry) const =0
 Fetch the geometry of the shape. More...
 
virtual bool getConvexMeshGeometry (PxConvexMeshGeometry &geometry) const =0
 Fetch the geometry of the shape. More...
 
virtual bool getTriangleMeshGeometry (PxTriangleMeshGeometry &geometry) const =0
 Fetch the geometry of the shape. More...
 
virtual bool getHeightFieldGeometry (PxHeightFieldGeometry &geometry) const =0
 Fetch the geometry of the shape. More...
 
virtual PxRigidActorgetActor () const =0
 Retrieves the actor which this shape is associated with. More...
 
virtual void setMaterials (PxMaterial *const *materials, PxU16 materialCount)=0
 Assigns material(s) to the shape. More...
 
virtual PxU16 getNbMaterials () const =0
 Returns the number of materials assigned to the shape. More...
 
virtual PxU32 getMaterials (PxMaterial **userBuffer, PxU32 bufferSize) const =0
 Retrieve all the material pointers associated with the shape. More...
 
virtual PxMaterialgetMaterialFromInternalFaceIndex (PxU32 faceIndex) const =0
 Retrieve material from given triangle index. More...
 
virtual void setContactOffset (PxReal contactOffset)=0
 Sets the contact offset. More...
 
virtual PxReal getContactOffset () const =0
 Retrieves the contact offset. More...
 
virtual void setRestOffset (PxReal restOffset)=0
 Sets the rest offset. More...
 
virtual PxReal getRestOffset () const =0
 Retrieves the rest offset. More...
 
virtual void setFlag (PxShapeFlag::Enum flag, bool value)=0
 Sets shape flags. More...
 
virtual void setFlags (PxShapeFlags inFlags)=0
 Sets shape flags. More...
 
virtual PxShapeFlags getFlags () const =0
 Retrieves shape flags. More...
 
virtual bool isExclusive () const =0
 Returns true if the shape is exclusive to an actor. More...
 
virtual void setName (const char *name)=0
 Sets a name string for the object that can be retrieved with getName(). More...
 
virtual const char * getName () const =0
 retrieves the name string set with setName(). More...
 
virtual const char * getConcreteTypeName () const
 Returns string name of dynamic type. More...
 
Pose Manipulation
virtual void setLocalPose (const PxTransform &pose)=0
 Sets the pose of the shape in actor space, i.e. relative to the actors to which they are attached. More...
 
virtual PxTransform getLocalPose () const =0
 Retrieves the pose of the shape in actor space, i.e. relative to the actor they are owned by. More...
 
Collision Filtering
virtual void setSimulationFilterData (const PxFilterData &data)=0
 Sets the user definable collision filter data. More...
 
virtual PxFilterData getSimulationFilterData () const =0
 Retrieves the shape's collision filter data. More...
 
virtual PX_DEPRECATED void resetFiltering ()=0
 Marks the object to reset interactions and re-run collision filters in the next simulation step. More...
 
virtual void setQueryFilterData (const PxFilterData &data)=0
 Sets the user definable query filter data. More...
 
virtual PxFilterData getQueryFilterData () const =0
 Retrieves the shape's Query filter data. More...
 
- Public Member Functions inherited from PxBase
template<class T >
T * is ()
 
template<class T >
const T * is () const
 
PX_INLINE PxType getConcreteType () const
 Returns concrete type of object. More...
 
PX_INLINE void setBaseFlag (PxBaseFlag::Enum flag, bool value)
 Set PxBaseFlag. More...
 
PX_INLINE void setBaseFlags (PxBaseFlags inFlags)
 Set PxBaseFlags. More...
 
PX_INLINE PxBaseFlags getBaseFlags () const
 Returns PxBaseFlags. More...
 
virtual bool isReleasable () const
 Whether the object is subordinate. More...
 

Public Attributes

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

Protected Member Functions

PX_INLINE PxShape (PxBaseFlags baseFlags)
 
PX_INLINE PxShape (PxType concreteType, PxBaseFlags baseFlags)
 
virtual ~PxShape ()
 
virtual bool isKindOf (const char *name) const
 Returns whether a given type name matches with the type of this instance. More...
 
- Protected Member Functions inherited from PxBase
PX_INLINE PxBase (PxType concreteType, PxBaseFlags baseFlags)
 Constructor setting concrete type and base flags. More...
 
PX_INLINE PxBase (PxBaseFlags baseFlags)
 Deserialization constructor setting base flags. More...
 
virtual ~PxBase ()
 Destructor. More...
 
template<class T >
bool typeMatch () const
 

Additional Inherited Members

- Protected Attributes inherited from PxBase
PxType mConcreteType
 
PxBaseFlags mBaseFlags
 

Detailed Description

Abstract class for collision shapes.

Shapes are shared, reference counted objects.

An instance can be created by calling the createShape() method of the PxRigidActor class, or the createShape() method of the PxPhysics class.

Visualizations

See Also
PxPhysics.createShape() PxRigidActor.createShape() PxBoxGeometry PxSphereGeometry PxCapsuleGeometry PxPlaneGeometry PxConvexMeshGeometry PxTriangleMeshGeometry PxHeightFieldGeometry

Constructor & Destructor Documentation

PX_INLINE PxShape::PxShape ( PxBaseFlags  baseFlags)
inlineprotected
PX_INLINE PxShape::PxShape ( PxType  concreteType,
PxBaseFlags  baseFlags 
)
inlineprotected
virtual PxShape::~PxShape ( )
inlineprotectedvirtual

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, if it is an exclusive shape, else NULL
See Also
PxRigidStatic, PxRigidDynamic, PxArticulationLink
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]geometryThe 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]geometryThe 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
inlinevirtual

Returns string name of dynamic type.

Returns
Class name of most derived type of this object.

Reimplemented from PxBase.

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]geometryThe 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()

Referenced by PxShapeExt::getWorldBounds(), PxShapeExt::overlap(), PxShapeExt::raycast(), and PxShapeExt::sweep().

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]geometryThe 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]faceIndexThe internal triangle index whose material you want to retrieve.
Returns
Material from input triangle
Note
If faceIndex value of 0xFFFFffff is passed as an input for mesh and heightfield shapes, this function will issue a warning and return NULL.
Scene queries set the value of PxQueryHit::faceIndex to 0xFFFFffff whenever it is undefined or does not apply.
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]userBufferThe buffer to store the material pointers.
[in]bufferSizeSize 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 PxU16 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]geometryThe 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]geometryThe 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]geometryThe descriptor to save the shape's geometry data to.
Returns
True on success else false
See Also
PxGeometry PxGeometryType getGeometryType()
virtual bool PxShape::isExclusive ( ) const
pure virtual

Returns true if the shape is exclusive to an actor.

See Also
PxPhysics::createShape()
virtual bool PxShape::isKindOf ( const char *  superClass) const
inlineprotectedvirtual

Returns whether a given type name matches with the type of this instance.

Reimplemented from PxBase.

References PxBase::isKindOf().

virtual void PxShape::release ( )
pure virtual

Decrements the reference count of a shape and releases it if the new reference count is zero.

Note that in releases prior to PhysX 3.3 this method did not have reference counting semantics and was used to destroy a shape created with PxActor::createShape(). In PhysX 3.3 and above, this usage is deprecated, instead, use PxRigidActor::detachShape() to detach a shape from an actor. If the shape to be detached was created with PxActor::createShape(), the actor holds the only counted reference, and so when the shape is detached it will also be destroyed.

See Also
PxRigidActor::createShape() PxPhysics::createShape() PxRigidActor::attachShape() PxRigidActor::detachShape()

Implements PxBase.

virtual PX_DEPRECATED void PxShape::resetFiltering ( )
pure virtual

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

Deprecated:
Note
This method has been deprecated. Please use PxScene::resetFiltering() instead.
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]contactOffsetRange: [maximum(0,restOffset), PX_MAX_F32)
See Also
getContactOffset PxTolerancesScale setRestOffset
virtual void PxShape::setFlag ( PxShapeFlag::Enum  flag,
bool  value 
)
pure virtual

Sets shape flags.

Sleeping: Does NOT wake the associated actor up automatically.

Parameters
[in]flagThe shape flag to enable/disable. See PxShapeFlag.
[in]valueTrue 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.
This function does not guarantee correct/continuous behavior when objects are resting on top of old or new geometry.
Parameters
[in]geometryNew 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 actors to which they are attached.

This transformation is identity by default.

The local pose is an attribute of the shape, and so will apply to all actors to which the shape is attached.

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]poseThe new transform from the actor frame to the shape frame. Range: rigid body transform
See Also
getLocalPose()

Referenced by PxRigidActor::createShape().

virtual void PxShape::setMaterials ( PxMaterial *const *  materials,
PxU16  materialCount 
)
pure virtual

Assigns material(s) to the shape.

Sleeping: Does NOT wake the associated actor up automatically.

Parameters
[in]materialsList of material pointers to assign to the shape. See PxMaterial
[in]materialCountThe 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]nameThe 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]restOffsetRange: (-PX_MAX_F32, 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()

Member Data Documentation

void* PxShape::userData

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-2015 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com