Panda3D
|
Abstract base class for character controllers. More...
#include "physxController.h"
Public Member Functions | |
virtual TypeHandle | force_init_type () |
PhysxActor * | get_actor () const |
Retrieves the actor which this controller is associated with. | |
float | get_h () const |
Returns the heading of the controller in global space. | |
LPoint3f | get_pos () const |
Retruns the position of the controller is global space. | |
float | get_sharpness () const |
Returns the sharpness used to ease the motion curve when the auto-step feature is used. | |
virtual TypeHandle | get_type () const |
virtual void | link (NxController *controllerPtr)=0 |
void | ls () const |
void | ls (ostream &out, int indent_level=0) const |
virtual NxController * | ptr () const =0 |
void | release () |
void | report_scene_changed () |
The character controller uses caching in order to speed up collision testing, this caching can not detect when static objects have changed in the scene. | |
void | set_collision (bool enable) |
Enable/Disable collisions for this controller and actor. | |
void | set_global_speed (const LVector3f &speed) |
Sets the linear speed of the controller in global space. | |
void | set_h (float heading) |
Sets the heading of the controller is global space. | |
void | set_local_speed (const LVector3f &speed) |
Sets the linear speed of the controller in local coordinates. | |
void | set_min_distance (float min_dist) |
Sets the the minimum travelled distance to consider when moving the controller. | |
void | set_omega (float omega) |
Sets the angular velocity (degrees per second) of the controller. | |
void | set_pos (const LPoint3f &pos) |
Sets the position of the controller is global space. | |
void | set_sharpness (float sharpness) |
Sharpness is used to smooth motion with a feedback filter, having a value between 0 (so smooth it doesn't move) and 1 (no smoothing = unfiltered motion). | |
void | set_step_offset (float offset) |
Sets the step height/offset for the controller. | |
void | start_jump (float v0) |
Enters the jump mode. | |
void | stop_jump () |
Leaves the jump mode. | |
virtual void | unlink ()=0 |
void | update_controller (float dt) |
Static Public Member Functions | |
static PhysxController * | factory (NxControllerType shapeType) |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. |
Abstract base class for character controllers.
Definition at line 32 of file physxController.h.
PhysxActor * PhysxController::get_actor | ( | ) | const |
Retrieves the actor which this controller is associated with.
Definition at line 72 of file physxController.cxx.
Referenced by set_local_speed().
float PhysxController::get_h | ( | ) | const |
Returns the heading of the controller in global space.
Definition at line 260 of file physxController.cxx.
LPoint3f PhysxController::get_pos | ( | ) | const |
Retruns the position of the controller is global space.
Definition at line 99 of file physxController.cxx.
References PhysxManager::nxExtVec3_to_point3(), and LPoint3f::zero().
float PhysxController::get_sharpness | ( | ) | const |
Returns the sharpness used to ease the motion curve when the auto-step feature is used.
Default value is 1.0.
Definition at line 133 of file physxController.cxx.
static void PhysxController::init_type | ( | ) | [inline, static] |
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Making it inline seems to cause problems in the optimizer.
Reimplemented from PhysxObject.
Reimplemented in PhysxCapsuleController, and PhysxBoxController.
Definition at line 98 of file physxController.h.
References PhysxObject::init_type().
Referenced by PhysxBoxController::init_type(), and PhysxCapsuleController::init_type().
The character controller uses caching in order to speed up collision testing, this caching can not detect when static objects have changed in the scene.
You need to call this method when such changes have been made.
Definition at line 276 of file physxController.cxx.
void PhysxController::set_collision | ( | bool | enable | ) |
Enable/Disable collisions for this controller and actor.
Definition at line 146 of file physxController.cxx.
void PhysxController::set_global_speed | ( | const LVector3f & | speed | ) |
Sets the linear speed of the controller in global space.
Definition at line 192 of file physxController.cxx.
References LVecBase3f::is_nan().
void PhysxController::set_h | ( | float | heading | ) |
Sets the heading of the controller is global space.
Note: only heading is supported. Pitch and roll are constrained by PhysX in order to alyways keep the character upright.
Definition at line 244 of file physxController.cxx.
void PhysxController::set_local_speed | ( | const LVector3f & | speed | ) |
Sets the linear speed of the controller in local coordinates.
Definition at line 207 of file physxController.cxx.
References get_actor(), PhysxActor::get_node_path(), and LVecBase3f::is_nan().
void PhysxController::set_min_distance | ( | float | min_dist | ) |
Sets the the minimum travelled distance to consider when moving the controller.
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. The default value is 0.0001.
Definition at line 163 of file physxController.cxx.
void PhysxController::set_omega | ( | float | omega | ) |
Sets the angular velocity (degrees per second) of the controller.
The angular velocity is used to compute the new heading when updating the controller.
Definition at line 229 of file physxController.cxx.
void PhysxController::set_pos | ( | const LPoint3f & | pos | ) |
Sets the position of the controller is global space.
This can be used for initial placement or for teleporting the character.
Definition at line 86 of file physxController.cxx.
References PhysxManager::point3_to_nxExtVec3().
void PhysxController::set_sharpness | ( | float | sharpness | ) |
Sharpness is used to smooth motion with a feedback filter, having a value between 0 (so smooth it doesn't move) and 1 (no smoothing = unfiltered motion).
Sharpness can ease the motion curve when the auto-step feature is used with boxes. Default value is 1.0.
Definition at line 116 of file physxController.cxx.
void PhysxController::set_step_offset | ( | float | offset | ) |
Sets the step height/offset for the controller.
Definition at line 177 of file physxController.cxx.
void PhysxController::start_jump | ( | float | v0 | ) |
Enters the jump mode.
The parameter is the intial upward velocity of the character.
Definition at line 351 of file physxController.cxx.
void PhysxController::stop_jump | ( | ) |
Leaves the jump mode.
This method is automatically called if a ground collision is detected. Usually users need not call this method.
Definition at line 372 of file physxController.cxx.
References EventQueue::get_global_event_queue().