Panda3D
|
Actors are the main simulation objects. More...
#include "physxActor.h"
Public Member Functions | |
void | add_force (const LVector3f force, PhysxForceMode mode=FM_force, bool wakeup=true) |
Applies a force (or impulse) defined in the global coordinate frame to the actor. | |
void | add_force_at_local_pos (const LVector3f force, const LPoint3f &pos, PhysxForceMode mode=FM_force, bool wakeup=true) |
Applies a force (or impulse) defined in the global coordinate frame, acting at a particular point in local coordinates, to the actor. | |
void | add_force_at_pos (const LVector3f force, const LPoint3f &pos, PhysxForceMode mode=FM_force, bool wakeup=true) |
Applies a force (or impulse) defined in the global coordinate frame, acting at a particular point in global coordinates, to the actor. | |
void | add_local_force (const LVector3f force, PhysxForceMode mode=FM_force, bool wakeup=true) |
Applies a force (or impulse) defined in the actor local coordinate frame to the actor. | |
void | add_local_force_at_local_pos (const LVector3f force, const LPoint3f &pos, PhysxForceMode mode=FM_force, bool wakeup=true) |
Applies a force (or impulse) defined in the actor local coordinate frame, acting at a particular point in local coordinates, to the actor. | |
void | add_local_force_at_pos (const LVector3f force, const LPoint3f &pos, PhysxForceMode mode=FM_force, bool wakeup=true) |
Applies a force (or impulse) defined in the actor local coordinate frame, acting at a particular point in global coordinates, to the actor. | |
void | add_local_torque (const LVector3f torque, PhysxForceMode mode=FM_force, bool wakeup=true) |
Applies an impulsive torque defined in the actor local coordinate frame to the actor. | |
void | add_torque (const LVector3f torque, PhysxForceMode mode=FM_force, bool wakeup=true) |
Applies an impulsive torque defined in the global coordinate frame to the actor. | |
void | attach_node_path (const NodePath &np) |
Attaches a node path to this actor. | |
float | compute_kinetic_energy () const |
Computes the total kinetic (rotational and translational) energy of the object. | |
PhysxShape * | create_shape (PhysxShapeDesc &desc) |
Creates a new shape and adds it to the list of shapes of this actor. | |
void | detach_node_path () |
Detaches a previously assigned NodePath from this actor. | |
virtual TypeHandle | force_init_type () |
bool | get_actor_flag (PhysxActorFlag flag) const |
Return the specified ActorFlag flag. | |
float | get_angular_damping () const |
Returns the angular damping coefficient. | |
LVector3f | get_angular_momentum () const |
Retrieves the angular momentum of an actor. | |
LVector3f | get_angular_velocity () const |
Returns the angular velocity of the actor. | |
bool | get_body_flag (PhysxBodyFlag flag) const |
Return the specified BodyFlag flag. | |
LMatrix4f | get_c_mass_global_mat () const |
Returns the center of mass transform in world space. | |
LMatrix3f | get_c_mass_global_orientation () const |
Returns the center of mass orientation in world space. | |
LPoint3f | get_c_mass_global_pos () const |
Returns the center of mass position in world space. | |
LMatrix4f | get_c_mass_local_mat () const |
Returns the center of mass transform relative to the actor. | |
LMatrix3f | get_c_mass_local_orientation () const |
Returns the center of mass orientation relative to the actor. | |
LPoint3f | get_c_mass_local_pos () const |
Returns the center of mass position relative to the actor. | |
unsigned int | get_dominance_group () const |
Retrieves the dominance group of this actor. | |
LMatrix3f | get_global_inertia_tensor () const |
Returns the inertia tensor of the actor relative to the world coordinate frame. | |
LMatrix3f | get_global_inertia_tensor_inverse () const |
Returns the inverse of the inertia tensor of the actor relative to the world coordinate frame. | |
LMatrix4f | get_global_mat () const |
Retrieves the actors world space transform. | |
LPoint3f | get_global_pos () const |
Retrieves the actors world space position. | |
LQuaternionf | get_global_quat () const |
Retrieves the actors world space orientation. | |
unsigned int | get_group () const |
Retrieves the actor group this actor is assigned to. | |
float | get_linear_damping () const |
Retrieves the linear damping coefficient. | |
LVector3f | get_linear_momentum () const |
Retrieves the linear momentum of an actor. | |
LVector3f | get_linear_velocity () const |
Returns the linear velocity of an actor. | |
LVector3f | get_local_point_velocity (const LPoint3f &point) const |
Computes the velocity of a point given in body local coordinates as if it were attached to the actor and moving with it. | |
float | get_mass () const |
Returns the mass of the actor. | |
LVector3f | get_mass_space_inertia_tensor () const |
Returns the diagonal inertia tensor of the actor relative to the mass coordinate frame. | |
float | get_max_angular_velocity () const |
Returns the maximum angular velocity permitted for this actor. | |
const char * | get_name () const |
Retrieves the name string. | |
NodePath | get_node_path () const |
Retrieves a previously attached NodePath. | |
unsigned int | get_num_shapes () const |
Returns the number of shapes assigned to the actor. | |
LVector3f | get_point_velocity (const LPoint3f &point) const |
Computes the velocity of a point given in world coordinates if it were attached to the actor and moving with it. | |
PhysxScene * | get_scene () const |
Retrieves the scene which this actor belongs to. | |
PhysxShape * | get_shape (unsigned int idx) const |
Retrieves an individual shape from the actor's array of shapes. | |
PhysxShape * | get_shape_by_name (const char *name) const |
Retrieves an individual shape from the actor's array of shapes. | |
float | get_sleep_angular_velocity () const |
Returns the angular velocity below which an actor may go to sleep. | |
float | get_sleep_energy_threshold () const |
Returns the energy below which an actor may go to sleep. | |
float | get_sleep_linear_velocity () const |
Returns the linear velocity below which an actor may go to sleep. | |
virtual TypeHandle | get_type () const |
bool | is_dynamic () const |
Returns true if the actor is dynamic. | |
bool | is_sleeping () const |
Returns true if this body is sleeping. | |
void | link (NxActor *ptr) |
void | link_controller (PhysxController *controller) |
void | ls () const |
void | ls (ostream &out, int indent_level=0) const |
MAKE_SEQ (get_shapes, get_num_shapes, get_shape) | |
void | move_global_hpr (float h, float p, float r) |
The move_global_* calls serve to move kinematically controlled dynamic actors through the game world. | |
void | move_global_mat (const LMatrix4f &mat) |
The move_global_* calls serve to move kinematically controlled dynamic actors through the game world. | |
void | move_global_pos (const LPoint3f &pos) |
The move_global_* calls serve to move kinematically controlled dynamic actors through the game world. | |
NxActor * | ptr () const |
void | put_to_sleep () |
Forces the actor to sleep. | |
void | release () |
bool | save_body_to_desc (PhysxBodyDesc &bodyDesc) const |
Saves the body information of a dynamic actor to the passed body descriptor. | |
void | save_to_desc (PhysxActorDesc &actorDesc) const |
Saves the state of the actor to the passed descriptor. | |
void | set_actor_flag (PhysxActorFlag flag, bool value) |
Raise or lower individual ActorFlag flags. | |
void | set_angular_damping (float angDamp) |
Sets the angular damping coefficient. | |
void | set_angular_momentum (const LVector3f &momentum) |
Sets the angular momentum of the actor. | |
void | set_angular_velocity (const LVector3f &angVel) |
Sets the angular velocity of the actor. | |
void | set_body_flag (PhysxBodyFlag flag, bool value) |
Raise or lower individual BodyFlag flags. | |
void | set_c_mass_global_mat (const LMatrix4f &mat) |
Moves the actor by setting the transform of the center of mass. | |
void | set_c_mass_global_orientation (const LMatrix3f &mat) |
Moves the actor by setting the orientation of the center of mass. | |
void | set_c_mass_global_pos (const LPoint3f &pos) |
Moves the actor by setting the position of the center of mass. | |
void | set_c_mass_offset_global_mat (const LMatrix4f &mat) |
Sets the matrix of the center of mass relative to world space. | |
void | set_c_mass_offset_global_orientation (const LMatrix3f &mat) |
Sets the orientation of the center of mass relative to world space. | |
void | set_c_mass_offset_global_pos (const LPoint3f &pos) |
Sets the position of the center of mass relative to world space. | |
void | set_c_mass_offset_local_mat (const LMatrix4f &mat) |
Sets the matrix of the center of mass relative to the actor. | |
void | set_c_mass_offset_local_orientation (const LMatrix3f &mat) |
Sets the orientation of the center of mass relative to the actor. | |
void | set_c_mass_offset_local_pos (const LPoint3f &pos) |
Sets the position of the center of mass relative to the actor. | |
void | set_contact_report_flag (PhysxContactPairFlag flag, bool value) |
Sets the actor's contact report flags. | |
void | set_contact_report_threshold (float threshold) |
Sets the force threshold for contact reports. | |
void | set_dominance_group (unsigned int group) |
Assigns dynamic actors a dominance group identifier. | |
void | set_global_hpr (float h, float p, float r) |
Method for setting a dynamic actor's orientation in the world. | |
void | set_global_mat (const LMatrix4f &mat) |
Method for setting a dynamic actor's transform matrix in the world. | |
void | set_global_pos (const LPoint3f &pos) |
Method for setting a dynamic actor's position in the world. | |
void | set_group (unsigned int group) |
Assigns the actor to a user defined group of actors. | |
void | set_linear_damping (float linDamp) |
Sets the linear damping coefficient. | |
void | set_linear_momentum (const LVector3f &momentum) |
Sets the linear momentum of the actor. | |
void | set_linear_velocity (const LVector3f &linVel) |
Sets the linear velocity of the actor. | |
void | set_mass (float mass) |
Sets the mass of a dynamic actor. | |
void | set_mass_space_inertia_tensor (const LVector3f &m) |
Sets the inertia tensor, using a parameter specified in mass space coordinates. | |
void | set_max_angular_velocity (float maxAngVel) |
Lets you set the maximum angular velocity permitted for this actor. | |
void | set_name (const char *name) |
Sets a name string for the object that can be retrieved with get_name(). | |
void | set_shape_group (unsigned int group) |
Sets the collision group for all shapes of this actor. | |
void | set_sleep_angular_velocity (float threshold) |
Sets the angular velocity below which an actor may go to sleep. | |
void | set_sleep_energy_threshold (float threshold) |
Sets the energy threshold below which an actor may go to sleep. | |
void | set_sleep_linear_velocity (float threshold) |
Sets the linear velocity below which an actor may go to sleep. | |
void | unlink () |
bool | update_mass_from_shapes (float density, float totalMass) |
Recomputes a dynamic actor's mass properties from its shapes. | |
void | update_transform (const LMatrix4f m) |
Updates the transform of an assigned NodePath. | |
void | wake_up (float wakeCounterValue=NX_SLEEP_INTERVAL) |
Wakes up the actor if it is sleeping. | |
Static Public Member Functions | |
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. | |
Public Attributes | |
PhysxObjectCollection< PhysxShape > | _shapes |
Actors are the main simulation objects.
Actors are owned by a scene (PhysxScene).
An actor may optionally encapsulate a dynamic rigid body by setting the body member of the actor's descriptor when it is created. Otherwise the actor will be static (fixed in the world).
Instances of PhysxActor are created by calling PhysxScene::create_actor() and destroyed by calling PhysxActor::release().
Definition at line 48 of file physxActor.h.
void PhysxActor::add_force | ( | const LVector3f | force, |
PhysxForceMode | mode = FM_force , |
||
bool | wakeup = true |
||
) |
Applies a force (or impulse) defined in the global coordinate frame to the actor.
This will not induce a torque.
Mode determines if the torque is to be conventional or impulsive.
The actor must be dynamic. This call wakes the actor if it is sleeping and the wakeup parameter is true (default).
Definition at line 547 of file physxActor.cxx.
References LVecBase3f::is_nan(), and PhysxManager::vec3_to_nxVec3().
void PhysxActor::add_force_at_local_pos | ( | const LVector3f | force, |
const LPoint3f & | pos, | ||
PhysxForceMode | mode = FM_force , |
||
bool | wakeup = true |
||
) |
Applies a force (or impulse) defined in the global coordinate frame, acting at a particular point in local coordinates, to the actor.
Note that if the force does not act along the center of mass of the actor, this will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a total external force on an object by calling this once every frame.
Mode determines if the torque is to be conventional or impulsive.
The actor must be dynamic. This call wakes the actor if it is sleeping and the wakeup parameter is true (default).
Definition at line 608 of file physxActor.cxx.
References LVecBase3f::is_nan(), PhysxManager::point3_to_nxVec3(), and PhysxManager::vec3_to_nxVec3().
void PhysxActor::add_force_at_pos | ( | const LVector3f | force, |
const LPoint3f & | pos, | ||
PhysxForceMode | mode = FM_force , |
||
bool | wakeup = true |
||
) |
Applies a force (or impulse) defined in the global coordinate frame, acting at a particular point in global coordinates, to the actor.
Note that if the force does not act along the center of mass of the actor, this will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a total external force on an object by calling this once every frame.
Mode determines if the torque is to be conventional or impulsive.
The actor must be dynamic. This call wakes the actor if it is sleeping and the wakeup parameter is true (default).
Definition at line 577 of file physxActor.cxx.
References LVecBase3f::is_nan(), PhysxManager::point3_to_nxVec3(), and PhysxManager::vec3_to_nxVec3().
void PhysxActor::add_local_force | ( | const LVector3f | force, |
PhysxForceMode | mode = FM_force , |
||
bool | wakeup = true |
||
) |
Applies a force (or impulse) defined in the actor local coordinate frame to the actor.
This will not induce a torque.
Mode determines if the torque is to be conventional or impulsive.
The actor must be dynamic. This call wakes the actor if it is sleeping and the wakeup parameter is true (default).
Definition at line 654 of file physxActor.cxx.
References LVecBase3f::is_nan(), and PhysxManager::vec3_to_nxVec3().
void PhysxActor::add_local_force_at_local_pos | ( | const LVector3f | force, |
const LPoint3f & | pos, | ||
PhysxForceMode | mode = FM_force , |
||
bool | wakeup = true |
||
) |
Applies a force (or impulse) defined in the actor local coordinate frame, acting at a particular point in local coordinates, to the actor.
Note that if the force does not act along the center of mass of the actor, this will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a total external force on an object by calling this once every frame.
Mode determines if the torque is to be conventional or impulsive.
The actor must be dynamic. This call wakes the actor if it is sleeping and the wakeup parameter is true (default).
Definition at line 715 of file physxActor.cxx.
References LVecBase3f::is_nan(), PhysxManager::point3_to_nxVec3(), and PhysxManager::vec3_to_nxVec3().
void PhysxActor::add_local_force_at_pos | ( | const LVector3f | force, |
const LPoint3f & | pos, | ||
PhysxForceMode | mode = FM_force , |
||
bool | wakeup = true |
||
) |
Applies a force (or impulse) defined in the actor local coordinate frame, acting at a particular point in global coordinates, to the actor.
Note that if the force does not act along the center of mass of the actor, this will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a total external force on an object by calling this once every frame.
Mode determines if the torque is to be conventional or impulsive.
The actor must be dynamic. This call wakes the actor if it is sleeping and the wakeup parameter is true (default).
Definition at line 684 of file physxActor.cxx.
References LVecBase3f::is_nan(), PhysxManager::point3_to_nxVec3(), and PhysxManager::vec3_to_nxVec3().
void PhysxActor::add_local_torque | ( | const LVector3f | torque, |
PhysxForceMode | mode = FM_force , |
||
bool | wakeup = true |
||
) |
Applies an impulsive torque defined in the actor local coordinate frame to the actor.
Mode determines if the torque is to be conventional or impulsive.
The actor must be dynamic. This call wakes the actor if it is sleeping and the wakeup parameter is true (default).
Definition at line 738 of file physxActor.cxx.
References LVecBase3f::is_nan(), and PhysxManager::vec3_to_nxVec3().
void PhysxActor::add_torque | ( | const LVector3f | torque, |
PhysxForceMode | mode = FM_force , |
||
bool | wakeup = true |
||
) |
Applies an impulsive torque defined in the global coordinate frame to the actor.
Mode determines if the torque is to be conventional or impulsive.
The actor must be dynamic. This call wakes the actor if it is sleeping and the wakeup parameter is true (default).
Definition at line 631 of file physxActor.cxx.
References LVecBase3f::is_nan(), and PhysxManager::vec3_to_nxVec3().
void PhysxActor::attach_node_path | ( | const NodePath & | np | ) |
Attaches a node path to this actor.
The node path's transform will be updated automatically if the actor's transform changes (and only then).
Note: any non-uniform scale or shear set on the NodePath's transform will be overwritten at the time of the first update.
Definition at line 386 of file physxActor.cxx.
References NodePath::is_empty().
float PhysxActor::compute_kinetic_energy | ( | ) | const |
Computes the total kinetic (rotational and translational) energy of the object.
The actor must be dynamic.
Definition at line 796 of file physxActor.cxx.
PhysxShape * PhysxActor::create_shape | ( | PhysxShapeDesc & | desc | ) |
Creates a new shape and adds it to the list of shapes of this actor.
Mass properties of dynamic actors will not automatically be recomputed to reflect the new mass distribution implied by the shape. Follow this call with a call to update_mass_from_shapes() to do that.
Definition at line 467 of file physxActor.cxx.
void PhysxActor::detach_node_path | ( | ) |
Detaches a previously assigned NodePath from this actor.
The NodePath's transform will no longer be updated from the actor's transform.
Definition at line 402 of file physxActor.cxx.
bool PhysxActor::get_actor_flag | ( | PhysxActorFlag | flag | ) | const |
Return the specified ActorFlag flag.
Definition at line 884 of file physxActor.cxx.
float PhysxActor::get_angular_damping | ( | ) | const |
Returns the angular damping coefficient.
The actor must be dynamic.
Definition at line 1044 of file physxActor.cxx.
LVector3f PhysxActor::get_angular_momentum | ( | ) | const |
Retrieves the angular momentum of an actor.
The angular momentum is equal to the angular velocity times the global space inertia tensor. The actor must be dynamic.
Definition at line 1296 of file physxActor.cxx.
References PhysxManager::nxVec3_to_vec3(), and LVector3f::zero().
LVector3f PhysxActor::get_angular_velocity | ( | ) | const |
Returns the angular velocity of the actor.
The actor must be dynamic.
Definition at line 1179 of file physxActor.cxx.
References PhysxManager::nxVec3_to_vec3(), and LVector3f::zero().
bool PhysxActor::get_body_flag | ( | PhysxBodyFlag | flag | ) | const |
Return the specified BodyFlag flag.
Definition at line 856 of file physxActor.cxx.
LMatrix4f PhysxActor::get_c_mass_global_mat | ( | ) | const |
Returns the center of mass transform in world space.
Definition at line 1630 of file physxActor.cxx.
References PhysxManager::nxMat34_to_mat4(), and LMatrix4f::zeros_mat().
Returns the center of mass orientation in world space.
Definition at line 1656 of file physxActor.cxx.
References LMatrix3f::ident_mat(), and PhysxManager::nxMat33_to_mat3().
LPoint3f PhysxActor::get_c_mass_global_pos | ( | ) | const |
Returns the center of mass position in world space.
Definition at line 1643 of file physxActor.cxx.
References PhysxManager::nxVec3_to_point3(), and LPoint3f::zero().
LMatrix4f PhysxActor::get_c_mass_local_mat | ( | ) | const |
Returns the center of mass transform relative to the actor.
Definition at line 1669 of file physxActor.cxx.
References PhysxManager::nxMat34_to_mat4(), and LMatrix4f::zeros_mat().
Returns the center of mass orientation relative to the actor.
Definition at line 1695 of file physxActor.cxx.
References LMatrix3f::ident_mat(), and PhysxManager::nxMat33_to_mat3().
LPoint3f PhysxActor::get_c_mass_local_pos | ( | ) | const |
Returns the center of mass position relative to the actor.
Definition at line 1682 of file physxActor.cxx.
References PhysxManager::nxVec3_to_point3(), and LPoint3f::zero().
unsigned int PhysxActor::get_dominance_group | ( | ) | const |
Retrieves the dominance group of this actor.
Definition at line 1012 of file physxActor.cxx.
Returns the inertia tensor of the actor relative to the world coordinate frame.
Definition at line 1721 of file physxActor.cxx.
References LMatrix3f::ident_mat(), and PhysxManager::nxMat33_to_mat3().
Returns the inverse of the inertia tensor of the actor relative to the world coordinate frame.
Definition at line 1734 of file physxActor.cxx.
References LMatrix3f::ident_mat(), and PhysxManager::nxMat33_to_mat3().
LMatrix4f PhysxActor::get_global_mat | ( | ) | const |
Retrieves the actors world space transform.
Definition at line 205 of file physxActor.cxx.
References PhysxManager::nxMat34_to_mat4(), and LMatrix4f::zeros_mat().
LPoint3f PhysxActor::get_global_pos | ( | ) | const |
Retrieves the actors world space position.
Definition at line 193 of file physxActor.cxx.
References PhysxManager::nxVec3_to_point3(), and LPoint3f::zero().
LQuaternionf PhysxActor::get_global_quat | ( | ) | const |
Retrieves the actors world space orientation.
Definition at line 217 of file physxActor.cxx.
References PhysxManager::nxQuat_to_quat(), and LVecBase4f::zero().
unsigned int PhysxActor::get_group | ( | ) | const |
Retrieves the actor group this actor is assigned to.
Definition at line 971 of file physxActor.cxx.
float PhysxActor::get_linear_damping | ( | ) | const |
Retrieves the linear damping coefficient.
The actor must be dynamic.
Definition at line 1074 of file physxActor.cxx.
LVector3f PhysxActor::get_linear_momentum | ( | ) | const |
Retrieves the linear momentum of an actor.
The momentum is equal to the velocity times the mass. The actor must be dynamic.
Definition at line 1281 of file physxActor.cxx.
References PhysxManager::nxVec3_to_vec3(), and LVector3f::zero().
LVector3f PhysxActor::get_linear_velocity | ( | ) | const |
Returns the linear velocity of an actor.
The actor must be dynamic.
Definition at line 1166 of file physxActor.cxx.
References PhysxManager::nxVec3_to_vec3(), and LVector3f::zero().
LVector3f PhysxActor::get_local_point_velocity | ( | const LPoint3f & | point | ) | const |
Computes the velocity of a point given in body local coordinates as if it were attached to the actor and moving with it.
The actor must be dynamic.
Definition at line 1227 of file physxActor.cxx.
References LVecBase3f::is_nan(), PhysxManager::nxVec3_to_vec3(), PhysxManager::point3_to_nxVec3(), and LVector3f::zero().
float PhysxActor::get_mass | ( | ) | const |
Returns the mass of the actor.
Definition at line 1487 of file physxActor.cxx.
Returns the diagonal inertia tensor of the actor relative to the mass coordinate frame.
Definition at line 1708 of file physxActor.cxx.
References PhysxManager::nxVec3_to_vec3(), and LVector3f::zero().
float PhysxActor::get_max_angular_velocity | ( | ) | const |
Returns the maximum angular velocity permitted for this actor.
Definition at line 1192 of file physxActor.cxx.
const char * PhysxActor::get_name | ( | ) | const |
Retrieves the name string.
Definition at line 151 of file physxActor.cxx.
NodePath PhysxActor::get_node_path | ( | ) | const |
Retrieves a previously attached NodePath.
An empty NodePath will be returned if no NodePath has been attached to this actor.
Definition at line 417 of file physxActor.cxx.
References NodePath::fail().
Referenced by PhysxController::set_local_speed().
unsigned int PhysxActor::get_num_shapes | ( | ) | const |
Returns the number of shapes assigned to the actor.
Definition at line 447 of file physxActor.cxx.
LVector3f PhysxActor::get_point_velocity | ( | const LPoint3f & | point | ) | const |
Computes the velocity of a point given in world coordinates if it were attached to the actor and moving with it.
The actor must be dynamic.
Definition at line 1208 of file physxActor.cxx.
References LVecBase3f::is_nan(), PhysxManager::nxVec3_to_vec3(), PhysxManager::point3_to_nxVec3(), and LVector3f::zero().
PhysxScene * PhysxActor::get_scene | ( | ) | const |
Retrieves the scene which this actor belongs to.
Definition at line 430 of file physxActor.cxx.
PhysxShape * PhysxActor::get_shape | ( | unsigned int | idx | ) | const |
Retrieves an individual shape from the actor's array of shapes.
Index must be in the range from zero to (number-of-shapes minus 1).
Definition at line 491 of file physxActor.cxx.
PhysxShape * PhysxActor::get_shape_by_name | ( | const char * | name | ) | const |
Retrieves an individual shape from the actor's array of shapes.
The first shape for which the shape's name matches the specified name is returned, or NULL if no shape has a matching name.
Definition at line 512 of file physxActor.cxx.
float PhysxActor::get_sleep_angular_velocity | ( | ) | const |
Returns the angular velocity below which an actor may go to sleep.
Actors whose angular velocity is above this threshold will not be put to sleep. The actor must be dynamic.
Definition at line 1388 of file physxActor.cxx.
float PhysxActor::get_sleep_energy_threshold | ( | ) | const |
Returns the energy below which an actor may go to sleep.
Actors whose energy is above this threshold will not be put to sleep. The actor must be dynamic.
Definition at line 1402 of file physxActor.cxx.
float PhysxActor::get_sleep_linear_velocity | ( | ) | const |
Returns the linear velocity below which an actor may go to sleep.
Actors whose linear velocity is above this threshold will not be put to sleep. The actor must be dynamic.
Definition at line 1373 of file physxActor.cxx.
static void PhysxActor::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.
Definition at line 209 of file physxActor.h.
References PhysxObject::init_type().
bool PhysxActor::is_dynamic | ( | ) | const |
Returns true if the actor is dynamic.
Definition at line 808 of file physxActor.cxx.
Referenced by set_dominance_group().
bool PhysxActor::is_sleeping | ( | ) | const |
Returns true if this body is sleeping.
When an actor does not move for a period of time, it is no longer simulated in order to save time. This state is called sleeping. However, because the object automatically wakes up when it is either touched by an awake object, or one of its properties is changed by the user, the entire sleep mechanism should be transparent to the user.
The actor must be dynamic.
Definition at line 1424 of file physxActor.cxx.
void PhysxActor::move_global_hpr | ( | float | h, |
float | p, | ||
float | r | ||
) |
The move_global_* calls serve to move kinematically controlled dynamic actors through the game world.
See move_global_mat() for more information.
This call wakes the actor if it is sleeping.
Definition at line 365 of file physxActor.cxx.
References PhysxManager::quat_to_nxQuat(), and LQuaternionf::set_hpr().
void PhysxActor::move_global_mat | ( | const LMatrix4f & | mat | ) |
The move_global_* calls serve to move kinematically controlled dynamic actors through the game world.
You set a dynamic actor to be kinematic using the BF_KINEMATIC body flag, used either in the PhysBodyDesc or with set_body_flag().
The move command will result in a velocity that, when successfully carried out (i.e. the motion is not blocked due to joints or collisions) inside run*(), will move the body into the desired pose. After the move is carried out during a single time step, the velocity is returned to zero. Thus, you must continuously call this in every time step for kinematic actors so that they move along a path.
These functions simply store the move destination until run*() is called, so consecutive calls will simply overwrite the stored target variable.
This call wakes the actor if it is sleeping.
Definition at line 346 of file physxActor.cxx.
References LMatrix4f::is_nan(), and PhysxManager::mat4_to_nxMat34().
void PhysxActor::move_global_pos | ( | const LPoint3f & | pos | ) |
The move_global_* calls serve to move kinematically controlled dynamic actors through the game world.
See move_global_mat() for more information.
This call wakes the actor if it is sleeping.
Definition at line 311 of file physxActor.cxx.
References LVecBase3f::is_nan(), and PhysxManager::point3_to_nxVec3().
void PhysxActor::put_to_sleep | ( | ) |
Forces the actor to sleep.
The actor will stay asleep until the next call to simulate, and will not wake up until then even when otherwise it would (for example a force is applied to it). It can however wake up during the next do_physics call.
The actor must be dynamic.
Definition at line 1463 of file physxActor.cxx.
bool PhysxActor::save_body_to_desc | ( | PhysxBodyDesc & | bodyDesc | ) | const |
Saves the body information of a dynamic actor to the passed body descriptor.
Definition at line 109 of file physxActor.cxx.
void PhysxActor::save_to_desc | ( | PhysxActorDesc & | actorDesc | ) | const |
Saves the state of the actor to the passed descriptor.
Definition at line 122 of file physxActor.cxx.
void PhysxActor::set_actor_flag | ( | PhysxActorFlag | flag, |
bool | value | ||
) |
Raise or lower individual ActorFlag flags.
Definition at line 868 of file physxActor.cxx.
void PhysxActor::set_angular_damping | ( | float | angDamp | ) |
Sets the angular damping coefficient.
Zero represents no damping. The angular damping coefficient must be nonnegative. The actor must be dynamic. Default: 0.05
Definition at line 1029 of file physxActor.cxx.
void PhysxActor::set_angular_momentum | ( | const LVector3f & | momentum | ) |
Sets the angular momentum of the actor.
Note that if you continuously set the angular velocity of an actor yourself, forces such as friction will not be able to rotate the actor, because forces directly influence only the velocity of actor. The actor must be dynamic.
Definition at line 1266 of file physxActor.cxx.
References PhysxManager::vec3_to_nxVec3().
void PhysxActor::set_angular_velocity | ( | const LVector3f & | angVel | ) |
Sets the angular velocity of the actor.
Note that if you continuously set the angular velocity of an actor yourself, forces such as friction will not be able to rotate the actor, because forces directly influence only the velocity/momentum.
The actor must be dynamic.
Definition at line 1116 of file physxActor.cxx.
References PhysxManager::vec3_to_nxVec3().
void PhysxActor::set_body_flag | ( | PhysxBodyFlag | flag, |
bool | value | ||
) |
Raise or lower individual BodyFlag flags.
Definition at line 840 of file physxActor.cxx.
void PhysxActor::set_c_mass_global_mat | ( | const LMatrix4f & | mat | ) |
Moves the actor by setting the transform of the center of mass.
Definition at line 1578 of file physxActor.cxx.
References PhysxManager::mat4_to_nxMat34().
void PhysxActor::set_c_mass_global_orientation | ( | const LMatrix3f & | mat | ) |
Moves the actor by setting the orientation of the center of mass.
Definition at line 1604 of file physxActor.cxx.
References PhysxManager::mat3_to_nxMat33().
void PhysxActor::set_c_mass_global_pos | ( | const LPoint3f & | pos | ) |
Moves the actor by setting the position of the center of mass.
Definition at line 1591 of file physxActor.cxx.
References PhysxManager::point3_to_nxVec3().
void PhysxActor::set_c_mass_offset_global_mat | ( | const LMatrix4f & | mat | ) |
Sets the matrix of the center of mass relative to world space.
Definition at line 1539 of file physxActor.cxx.
References PhysxManager::mat4_to_nxMat34().
void PhysxActor::set_c_mass_offset_global_orientation | ( | const LMatrix3f & | mat | ) |
Sets the orientation of the center of mass relative to world space.
Definition at line 1565 of file physxActor.cxx.
References PhysxManager::mat3_to_nxMat33().
void PhysxActor::set_c_mass_offset_global_pos | ( | const LPoint3f & | pos | ) |
Sets the position of the center of mass relative to world space.
Definition at line 1552 of file physxActor.cxx.
References PhysxManager::point3_to_nxVec3().
void PhysxActor::set_c_mass_offset_local_mat | ( | const LMatrix4f & | mat | ) |
Sets the matrix of the center of mass relative to the actor.
Definition at line 1500 of file physxActor.cxx.
References PhysxManager::mat4_to_nxMat34().
void PhysxActor::set_c_mass_offset_local_orientation | ( | const LMatrix3f & | mat | ) |
Sets the orientation of the center of mass relative to the actor.
Definition at line 1526 of file physxActor.cxx.
References PhysxManager::mat3_to_nxMat33().
void PhysxActor::set_c_mass_offset_local_pos | ( | const LPoint3f & | pos | ) |
Sets the position of the center of mass relative to the actor.
Definition at line 1513 of file physxActor.cxx.
References PhysxManager::point3_to_nxVec3().
void PhysxActor::set_contact_report_flag | ( | PhysxContactPairFlag | flag, |
bool | value | ||
) |
Sets the actor's contact report flags.
These flags are used to determine the kind of report that is generated for interactions with other actors.
Please note: If the actor is part of an interacting pair for which the contact report generation is controlled already through any other mechanism (for example by use of PhysxScene::set_actor_pair_flags) then the union of all the specified contact report flags will be used to generate the report.
Definition at line 908 of file physxActor.cxx.
void PhysxActor::set_contact_report_threshold | ( | float | threshold | ) |
Sets the force threshold for contact reports.
The actor must be dynamic.
Definition at line 931 of file physxActor.cxx.
void PhysxActor::set_dominance_group | ( | unsigned int | group | ) |
Assigns dynamic actors a dominance group identifier.
Dominance groups are integere in the range from 0 to 31.
This is similar to shape groups, except those serve a different purpose.
The PhysxScene::set_dominance_group_pair() lets you set certain behaviors for pairs of dominance groups.
By default every actor is created in group 0. Static actors must stay in group 0; thus you can only call this on dynamic actors.
Definition at line 997 of file physxActor.cxx.
References is_dynamic().
void PhysxActor::set_global_hpr | ( | float | h, |
float | p, | ||
float | r | ||
) |
Method for setting a dynamic actor's orientation in the world.
Please see set_global_mat for some caveats.
Definition at line 291 of file physxActor.cxx.
References PhysxManager::quat_to_nxQuat(), and LQuaternionf::set_hpr().
void PhysxActor::set_global_mat | ( | const LMatrix4f & | mat | ) |
Method for setting a dynamic actor's transform matrix in the world.
This method instantaneously changes the actor space to world space transformation.
One should exercise restraint in making use of these methods.
Static actors should not be moved at all. There are various internal data structures for static actors which may need to be recomputed when one moves. Also, moving static actors will not interact correctly with dynamic actors or joints. If you would like to directly control an actor's position and would like to have it correctly interact with dynamic bodies and joints, you should create a dynamic body with the BF_kinematic flag, and then use the move_global_*() commands to move it along a path!
When briefly moving dynamic actors, one should not:
Definition at line 275 of file physxActor.cxx.
References LMatrix4f::is_nan(), and PhysxManager::mat4_to_nxMat34().
void PhysxActor::set_global_pos | ( | const LPoint3f & | pos | ) |
Method for setting a dynamic actor's position in the world.
Please see set_global_mat for some caveats.
Definition at line 231 of file physxActor.cxx.
References LVecBase3f::is_nan(), and PhysxManager::point3_to_nxVec3().
void PhysxActor::set_group | ( | unsigned int | group | ) |
Assigns the actor to a user defined group of actors.
The actor group must be an integer in between 0 and 0x7fff (32767).
This is similar to NxShape groups, except those are only five bits and serve a different purpose.
The PhysxScene::set_actor_group_pair_flags() lets you set certain behaviors for pairs of actor groups.
By default every actor is created in group 0.
Definition at line 956 of file physxActor.cxx.
void PhysxActor::set_linear_damping | ( | float | linDamp | ) |
Sets the linear damping coefficient.
Zero represents no damping. The damping coefficient must be nonnegative. The actor must be dynamic. Default: 0
Definition at line 1059 of file physxActor.cxx.
void PhysxActor::set_linear_momentum | ( | const LVector3f & | momentum | ) |
Sets the linear momentum of the actor.
Note that if you continuously set the linear momentum of an actor yourself, forces such as gravity or friction will not be able to manifest themselves, because forces directly influence only the velocity/momentum of a actor. The actor must be dynamic.
Definition at line 1248 of file physxActor.cxx.
References PhysxManager::vec3_to_nxVec3().
void PhysxActor::set_linear_velocity | ( | const LVector3f & | linVel | ) |
Sets the linear velocity of the actor.
Note that if you continuously set the velocity of an actor yourself, forces such as gravity or friction will not be able to manifest themselves, because forces directly influence only the velocity/momentum of an actor.
The actor must be dynamic.
Definition at line 1094 of file physxActor.cxx.
References PhysxManager::vec3_to_nxVec3().
void PhysxActor::set_mass | ( | float | mass | ) |
Sets the mass of a dynamic actor.
Definition at line 1475 of file physxActor.cxx.
void PhysxActor::set_mass_space_inertia_tensor | ( | const LVector3f & | m | ) |
Sets the inertia tensor, using a parameter specified in mass space coordinates.
Definition at line 1617 of file physxActor.cxx.
References PhysxManager::vec3_to_nxVec3().
void PhysxActor::set_max_angular_velocity | ( | float | maxAngVel | ) |
Lets you set the maximum angular velocity permitted for this actor.
Because for various internal computations, very quickly rotating actors introduce error into the simulation, which leads to undesired results.
With PhysxManager::set_parameter(PP_max_angular_velocity) you can set the default maximum velocity for actors created after the call. Bodies' high angular velocities are clamped to this value.
However, because some actors, such as car wheels, should be able to rotate quickly, you can override the default setting on a per-actor basis with the below call. Note that objects such as wheels which are approximated with spherical or other smooth collision primitives can be simulated with stability at a much higher angular velocity than, say, a box that has corners.
The actor must be dynamic.
Definition at line 1151 of file physxActor.cxx.
void PhysxActor::set_name | ( | const char * | name | ) |
Sets a name string for the object that can be retrieved with get_name().
This is for debugging and is not used by the engine.
Definition at line 137 of file physxActor.cxx.
void PhysxActor::set_shape_group | ( | unsigned int | group | ) |
Sets the collision group for all shapes of this actor.
See PhysxShape.setGroup().
Definition at line 821 of file physxActor.cxx.
void PhysxActor::set_sleep_angular_velocity | ( | float | threshold | ) |
Sets the angular velocity below which an actor may go to sleep.
Actors whose angular velocity is above this threshold will not be put to sleep.
Setting the sleep angular/linear velocity only makes sense when the BF_energy_sleep_test is not set.
The actor must be dynamic.
Definition at line 1336 of file physxActor.cxx.
void PhysxActor::set_sleep_energy_threshold | ( | float | threshold | ) |
Sets the energy threshold below which an actor may go to sleep.
Actors whose kinematic energy is above this threshold will not be put to sleep.
Setting the sleep energy threshold only makes sense when the BF_energy_sleep_test is set. There are also other types of sleeping that uses the linear and angular velocities directly instead of the energy.
The actor must be dynamic.
Definition at line 1358 of file physxActor.cxx.
void PhysxActor::set_sleep_linear_velocity | ( | float | threshold | ) |
Sets the linear velocity below which an actor may go to sleep.
Actors whose linear velocity is above this threshold will not be put to sleep.
Setting the sleep angular/linear velocity only makes sense when the BF_energy_sleep_test is not set.
The actor must be dynamic.
Definition at line 1316 of file physxActor.cxx.
bool PhysxActor::update_mass_from_shapes | ( | float | density, |
float | totalMass | ||
) |
Recomputes a dynamic actor's mass properties from its shapes.
Given a constant density or total mass, the actors mass properties can be recomputed using the shapes attached to the actor. If the actor has no shapes, then only the totalMass parameter can be used. If all shapes in the actor are trigger shapes (non-physical), the call will fail.
The mass of each shape is either the shape's local density (as specified in the PhysxShapeDesc; default 1.0) multiplied by the shape's volume or a directly specified shape mass.
The inertia tensor, mass frame and center of mass will always be recomputed. If there are no shapes in the actor, the mass will be totalMass, and the mass frame will be set to the center of the actor.
If you supply a non-zero total mass, the actor's mass and inertia will first be computed as above and then scaled to fit this total mass.
If you supply a non-zero density, the actor's mass and inertia will first be computed as above and then scaled by this factor.
Either totalMass or density must be non-zero.
The actor must be dynamic.
Definition at line 782 of file physxActor.cxx.
void PhysxActor::update_transform | ( | const LMatrix4f | m | ) |
Updates the transform of an assigned NodePath.
If the actor has been created by a PhysxController then this method will update the NodePath's transform from the controller's transform.
Definition at line 166 of file physxActor.cxx.
References NodePath::get_top(), NodePath::is_empty(), and NodePath::set_transform().
Referenced by PhysxScene::fetch_results().
void PhysxActor::wake_up | ( | float | wakeCounterValue = NX_SLEEP_INTERVAL | ) |
Wakes up the actor if it is sleeping.
The wakeCounterValue determines how long until the body is put to sleep, a value of zero means that the body is sleeping. wake_up(0) is equivalent to PhysxActor::put_to_sleep().
The actor must be dynamic.
Definition at line 1443 of file physxActor.cxx.