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
\li PxVisualizationParameter::eCOLLISION_AABBS \li PxVisualizationParameter::eCOLLISION_SHAPES \li PxVisualizationParameter::eCOLLISION_AXES-
Nested Class Summary
Nested classes/interfaces inherited from class physx.NativeObject
NativeObject.Allocator<T> -
Field Summary
FieldsFields inherited from class physx.NativeObject
address, isExternallyAllocated, SIZEOF_BYTE, SIZEOF_DOUBLE, SIZEOF_FLOAT, SIZEOF_INT, SIZEOF_LONG, SIZEOF_POINTER, SIZEOF_SHORT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PxShapearrayGet(long baseAddress, int index) getActor()Retrieves the actor which this shape is associated with.floatRetrieves the contact offset.getFlags()Retrieves shape flags.Retrieve a reference to the shape's geometry.Retrieves the pose of the shape in actor space, i.e. relative to the actor they are owned by.getMaterialFromInternalFaceIndex(int faceIndex) Retrieve material from given triangle index.intgetMaterials(PxMaterialPtr userBuffer, int bufferSize, int startIndex) Retrieve all the material pointers associated with the shape.floatGets minimum torsional patch radius.getName()retrieves the name string set with setName().shortReturns the number of materials assigned to the shape.Retrieves the shape's Query filter data.floatRetrieves the rest offset.Retrieves the shape's collision filter data.floatGets torsional patch radius.*********************************************************************************************booleanReturns true if the shape is exclusive to an actor.voidsetContactOffset(float contactOffset) Sets the contact offset.voidsetFlag(PxShapeFlagEnum flag, boolean value) Sets shape flagsvoidsetFlags(PxShapeFlags inFlags) Sets shape flagsvoidsetGeometry(PxGeometry geometry) Adjust the geometry of the shape.voidsetLocalPose(PxTransform pose) Sets the pose of the shape in actor space, i.e. relative to the actors to which they are attached.voidsetMaterials(PxMaterialPtr materials, short materialCount) Assigns material(s) to the shape.voidsetMinTorsionalPatchRadius(float radius) Sets minimum torsional patch radius.voidSets a name string for the object that can be retrieved with #getName().voidSets the user definable query filter data.voidsetRestOffset(float restOffset) Sets the rest offset.voidSets the user definable collision filter data.voidsetTorsionalPatchRadius(float radius) Sets torsional patch radius.voidsetUserData(NativeObject value) *********************************************************************************************static PxShapewrapPointer(long address) Methods inherited from class physx.common.PxRefCounted
acquireReference, getReferenceCountMethods inherited from class physx.common.PxBase
getBaseFlags, getConcreteType, getConcreteTypeName, isReleasable, release, setBaseFlag, setBaseFlagsMethods inherited from class physx.NativeObject
checkNotNull, equals, getAddress, hashCode
-
Field Details
-
SIZEOF
public static final int SIZEOF -
ALIGNOF
public static final int ALIGNOF- See Also:
-
-
Constructor Details
-
PxShape
protected PxShape() -
PxShape
protected PxShape(long address)
-
-
Method Details
-
wrapPointer
-
arrayGet
-
getUserData
********************************************************************************************* -
setUserData
********************************************************************************************* -
setGeometry
Adjust the geometry of the shape.Note: The type of the passed in geometry must match the geometry type of the shape. Note: It is not allowed to change the geometry type of a shape. Note: This function does not guarantee correct/continuous behavior when objects are resting on top of old or new geometry.
- Parameters:
geometry- New geometry of the shape.- See Also:
-
getGeometry
Retrieve a reference to the shape's geometry.\warning The returned reference has the same lifetime as the PxShape it comes from.
- Returns:
- Reference to internal PxGeometry object.
- See Also:
-
getActor
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:
-
setMaterials
Assigns material(s) to the shape. Will remove existing materials from the shape.Sleeping: Does NOT wake the associated actor up automatically.
- Parameters:
materials- List of material pointers to assign to the shape. See #PxMaterialmaterialCount- The number of materials provided.- See Also:
-
getNbMaterials
public short getNbMaterials()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:
-
getMaterials
Retrieve all the material pointers associated with the shape.You can retrieve the number of material pointers by calling #getNbMaterials()
Note: The returned data may contain invalid pointers if you release materials using #PxMaterial::release().
- Parameters:
userBuffer- The buffer to store the material pointers.bufferSize- Size of provided user buffer.startIndex- Index of first material pointer to be retrieved- Returns:
- Number of material pointers written to the buffer.
- See Also:
-
getMaterialFromInternalFaceIndex
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 or SDF triangle meshes, the function returns the single material associated with the shape, regardless of the index.
- Parameters:
faceIndex- The 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. Note: Scene queries set the value of PxQueryHit::faceIndex to 0xFFFFffff whenever it is undefined or does not apply.
- See Also:
-
setContactOffset
public void setContactOffset(float contactOffset) 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:
contactOffset- Range: [maximum(0,restOffset), PX_MAX_F32)- See Also:
-
getContactOffset
public float getContactOffset()Retrieves the contact offset.- Returns:
- The contact offset of the shape.
- See Also:
-
setRestOffset
public void setRestOffset(float restOffset) 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:
restOffset- Range: (-PX_MAX_F32, contactOffset)- See Also:
-
getRestOffset
public float getRestOffset()Retrieves the rest offset.- Returns:
- The rest offset of the shape.
- See Also:
-
setTorsionalPatchRadius
public void setTorsionalPatchRadius(float radius) Sets torsional patch radius.This defines the radius of the contact patch used to apply torsional friction. If the radius is 0, no torsional friction will be applied. If the radius is > 0, some torsional friction will be applied. This is proportional to the penetration depth so, if the shapes are separated or penetration is zero, no torsional friction will be applied. It is used to approximate rotational friction introduced by the compression of contacting surfaces.
Default: 0.0
- Parameters:
radius- Range: (0, PX_MAX_F32)
-
getTorsionalPatchRadius
public float getTorsionalPatchRadius()Gets torsional patch radius.This defines the radius of the contact patch used to apply torsional friction. If the radius is 0, no torsional friction will be applied. If the radius is > 0, some torsional friction will be applied. This is proportional to the penetration depth so, if the shapes are separated or penetration is zero, no torsional friction will be applied. It is used to approximate rotational friction introduced by the compression of contacting surfaces.
- Returns:
- The torsional patch radius of the shape.
-
setMinTorsionalPatchRadius
public void setMinTorsionalPatchRadius(float radius) Sets minimum torsional patch radius.This defines the minimum radius of the contact patch used to apply torsional friction. If the radius is 0, the amount of torsional friction that will be applied will be entirely dependent on the value of torsionalPatchRadius.
If the radius is > 0, some torsional friction will be applied regardless of the value of torsionalPatchRadius or the amount of penetration.
Default: 0.0
- Parameters:
radius- Range: (0, PX_MAX_F32)
-
getMinTorsionalPatchRadius
public float getMinTorsionalPatchRadius()Gets minimum torsional patch radius.This defines the minimum radius of the contact patch used to apply torsional friction. If the radius is 0, the amount of torsional friction that will be applied will be entirely dependent on the value of torsionalPatchRadius.
If the radius is > 0, some torsional friction will be applied regardless of the value of torsionalPatchRadius or the amount of penetration.
- Returns:
- The minimum torsional patch radius of the shape.
-
setFlag
Sets shape flagsSleeping: Does NOT wake the associated actor up automatically.
- Parameters:
flag- The shape flag to enable/disable. See #PxShapeFlag.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:
-
setFlags
Sets shape flags- See Also:
-
getFlags
Retrieves shape flags.- Returns:
- The values of the shape flags.
- See Also:
-
isExclusive
public boolean isExclusive()Returns true if the shape is exclusive to an actor. -
setName
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:
name- The name string to set the objects name to.- See Also:
-
getName
retrieves the name string set with setName().- Returns:
- The name associated with the shape.
- See Also:
-
setLocalPose
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:
pose- The new transform from the actor frame to the shape frame. Range: rigid body transform- See Also:
-
getLocalPose
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:
-
setSimulationFilterData
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
Retrieves the shape's collision filter data. -
setQueryFilterData
Sets the user definable query filter data.Default: (0,0,0,0)
- See Also:
-
getQueryFilterData
Retrieves the shape's Query filter data.
-