- Direct Known Subclasses:
PxBoxController,PxCapsuleController
- See Also:
-
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 PxControllerarrayGet(long baseAddress, int index) getActor()Get the rigid body actor associated with this controller (see PhysX documentation).floatRetrieve the contact offset.Retrieve the "foot" position of the controller, i.e. the position of the bottom of the CCT's shape.Retrieves the non-walkable mode for the CCT.Retrieve the raw position of the controller.getScene()Retrieve the scene associated with the controller.floatRetrieve the slope limit.voidgetState(PxControllerState state) Returns information about the controller's internal state.voidgetStats(PxControllerStats stats) Returns the controller's internal statistics.floatRetrieve the step height.getType()Return the type of controllerRetrieve the 'up' direction.Returns the user data associated with this controller.voidFlushes internal geometry cache.move(PxVec3 disp, float minDist, float elapsedTime, PxControllerFilters filters) Moves the character using a "collide-and-slide" algorithm.move(PxVec3 disp, float minDist, float elapsedTime, PxControllerFilters filters, PxObstacleContext obstacles) Moves the character using a "collide-and-slide" algorithm.voidrelease()Releases the controller.voidresize(float height) Resizes the controller.voidsetContactOffset(float offset) Sets the contact offset.booleansetFootPosition(PxExtendedVec3 position) Set controller's foot position.voidSets the non-walkable mode for the CCT.booleansetPosition(PxExtendedVec3 position) Sets controller's position.voidsetSlopeLimit(float slopeLimit) Sets the slope limit.voidsetStepOffset(float offset) The step height.voidsetUpDirection(PxVec3 up) Sets the 'up' direction.voidsetUserData(NativeObject userData) Sets the user data associated with this controller.static PxControllerwrapPointer(long address) Methods 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
-
PxController
protected PxController() -
PxController
protected PxController(long address)
-
-
Method Details
-
wrapPointer
-
arrayGet
-
getType
Return the type of controller -
release
public void release()Releases the controller. -
move
public PxControllerCollisionFlags move(PxVec3 disp, float minDist, float elapsedTime, PxControllerFilters filters) Moves the character using a "collide-and-slide" algorithm.- Parameters:
disp- Displacement vectorminDist- The minimum travelled distance to consider. If travelled distance is smaller, the character doesn't move. This is used to stop the recursive motion algorithm when remaining distance to travel is small.elapsedTime- Time elapsed since last callfilters- User-defined filters for this move- Returns:
- Collision flags, collection of ::PxControllerCollisionFlags
-
move
public PxControllerCollisionFlags move(PxVec3 disp, float minDist, float elapsedTime, PxControllerFilters filters, PxObstacleContext obstacles) Moves the character using a "collide-and-slide" algorithm.- Parameters:
disp- Displacement vectorminDist- The minimum travelled distance to consider. If travelled distance is smaller, the character doesn't move. This is used to stop the recursive motion algorithm when remaining distance to travel is small.elapsedTime- Time elapsed since last callfilters- User-defined filters for this moveobstacles- Potential additional obstacles the CCT should collide with.- Returns:
- Collision flags, collection of ::PxControllerCollisionFlags
-
setPosition
Sets controller's position.The position controlled by this function is the center of the collision shape.
\warning This is a 'teleport' function, it doesn't check for collisions. \warning The character's position must be such that it does not overlap the static geometry.
To move the character under normal conditions use the #move() function.
- Parameters:
position- The new (center) positon for the controller.- Returns:
- Currently always returns true.
- See Also:
-
getPosition
Retrieve the raw position of the controller.The position retrieved by this function is the center of the collision shape. To retrieve the bottom position of the shape, a.k.a. the foot position, use the getFootPosition() function.
The position is updated by calls to move(). Calling this method without calling move() will return the last position or the initial position of the controller.
- Returns:
- The controller's center position
- See Also:
-
setFootPosition
Set controller's foot position.The position controlled by this function is the bottom of the collision shape, a.k.a. the foot position.
Note: The foot position takes the contact offset into account
\warning This is a 'teleport' function, it doesn't check for collisions.
To move the character under normal conditions use the #move() function.
- Parameters:
position- The new (bottom) positon for the controller.- Returns:
- Currently always returns true.
- See Also:
-
getFootPosition
Retrieve the "foot" position of the controller, i.e. the position of the bottom of the CCT's shape.Note: The foot position takes the contact offset into account
- Returns:
- The controller's foot position
- See Also:
-
getActor
Get the rigid body actor associated with this controller (see PhysX documentation). The behavior upon manually altering this actor is undefined, you should primarily use it for reading const properties.- Returns:
- the actor associated with the controller.
-
setStepOffset
public void setStepOffset(float offset) The step height.- Parameters:
offset- The new step offset for the controller.
-
getStepOffset
public float getStepOffset()Retrieve the step height.- Returns:
- The step offset for the controller.
- See Also:
-
setNonWalkableMode
Sets the non-walkable mode for the CCT.- Parameters:
flag- The new value of the non-walkable mode.
-
getNonWalkableMode
Retrieves the non-walkable mode for the CCT.- Returns:
- The current non-walkable mode.
-
getContactOffset
public float getContactOffset()Retrieve the contact offset.- Returns:
- The contact offset for the controller.
-
setContactOffset
public void setContactOffset(float offset) Sets the contact offset.- Parameters:
offset- The contact offset for the controller.
-
getUpDirection
Retrieve the 'up' direction.- Returns:
- The up direction for the controller.
-
setUpDirection
Sets the 'up' direction.- Parameters:
up- The up direction for the controller.
-
getSlopeLimit
public float getSlopeLimit()Retrieve the slope limit.- Returns:
- The slope limit for the controller.
-
setSlopeLimit
public void setSlopeLimit(float slopeLimit) Sets the slope limit.Note: This feature can not be enabled at runtime, i.e. if the slope limit is zero when creating the CCT (which disables the feature) then changing the slope limit at runtime will not have any effect, and the call will be ignored.
- Parameters:
slopeLimit- The slope limit for the controller.
-
invalidateCache
public void invalidateCache()Flushes internal geometry cache.The character controller uses caching in order to speed up collision testing. The cache is automatically flushed when a change to static objects is detected in the scene. For example when a static shape is added, updated, or removed from the scene, the cache is automatically invalidated.
However there may be situations that cannot be automatically detected, and those require manual invalidation of the cache. Currently the user must call this when the filtering behavior changes (the PxControllerFilters parameter of the PxController::move call). While the controller in principle could detect a change in these parameters, it cannot detect a change in the behavior of the filtering function.
-
getScene
Retrieve the scene associated with the controller.- Returns:
- The physics scene
-
getUserData
Returns the user data associated with this controller.- Returns:
- The user pointer associated with the controller.
-
setUserData
Sets the user data associated with this controller.- Parameters:
userData- The user pointer associated with the controller.
-
getState
Returns information about the controller's internal state.- Parameters:
state- The controller's internal state- See Also:
-
getStats
Returns the controller's internal statistics.- Parameters:
stats- The controller's internal statistics- See Also:
-
resize
public void resize(float height) Resizes the controller.This function attempts to resize the controller to a given size, while making sure the bottom position of the controller remains constant. In other words the function modifies both the height and the (center) position of the controller. This is a helper function that can be used to implement a 'crouch' functionality for example.
- Parameters:
height- Desired controller's height
-