Panda3D
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
PhysxActor Class Reference

Actors are the main simulation objects. More...

#include "physxActor.h"

Inheritance diagram for PhysxActor:
PhysxObject PhysxEnums TypedReferenceCount TypedObject ReferenceCount MemoryBase MemoryBase

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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
void attach_node_path (const NodePath &np)
 Attaches a node path to this actor. More...
 
float compute_kinetic_energy () const
 Computes the total kinetic (rotational and translational) energy of the object. More...
 
PhysxShapecreate_shape (PhysxShapeDesc &desc)
 Creates a new shape and adds it to the list of shapes of this actor. More...
 
void detach_node_path ()
 Detaches a previously assigned NodePath from this actor. More...
 
virtual TypeHandle force_init_type ()
 
bool get_actor_flag (PhysxActorFlag flag) const
 Return the specified ActorFlag flag. More...
 
float get_angular_damping () const
 Returns the angular damping coefficient. More...
 
LVector3f get_angular_momentum () const
 Retrieves the angular momentum of an actor. More...
 
LVector3f get_angular_velocity () const
 Returns the angular velocity of the actor. More...
 
bool get_body_flag (PhysxBodyFlag flag) const
 Return the specified BodyFlag flag. More...
 
LMatrix4f get_c_mass_global_mat () const
 Returns the center of mass transform in world space. More...
 
LMatrix3f get_c_mass_global_orientation () const
 Returns the center of mass orientation in world space. More...
 
LPoint3f get_c_mass_global_pos () const
 Returns the center of mass position in world space. More...
 
LMatrix4f get_c_mass_local_mat () const
 Returns the center of mass transform relative to the actor. More...
 
LMatrix3f get_c_mass_local_orientation () const
 Returns the center of mass orientation relative to the actor. More...
 
LPoint3f get_c_mass_local_pos () const
 Returns the center of mass position relative to the actor. More...
 
unsigned int get_dominance_group () const
 Retrieves the dominance group of this actor. More...
 
LMatrix3f get_global_inertia_tensor () const
 Returns the inertia tensor of the actor relative to the world coordinate frame. More...
 
LMatrix3f get_global_inertia_tensor_inverse () const
 Returns the inverse of the inertia tensor of the actor relative to the world coordinate frame. More...
 
LMatrix4f get_global_mat () const
 Retrieves the actors world space transform. More...
 
LPoint3f get_global_pos () const
 Retrieves the actors world space position. More...
 
LQuaternionf get_global_quat () const
 Retrieves the actors world space orientation. More...
 
unsigned int get_group () const
 Retrieves the actor group this actor is assigned to. More...
 
float get_linear_damping () const
 Retrieves the linear damping coefficient. More...
 
LVector3f get_linear_momentum () const
 Retrieves the linear momentum of an actor. More...
 
LVector3f get_linear_velocity () const
 Returns the linear velocity of an actor. More...
 
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. More...
 
float get_mass () const
 Returns the mass of the actor. More...
 
LVector3f get_mass_space_inertia_tensor () const
 Returns the diagonal inertia tensor of the actor relative to the mass coordinate frame. More...
 
float get_max_angular_velocity () const
 Returns the maximum angular velocity permitted for this actor. More...
 
const char * get_name () const
 Retrieves the name string. More...
 
NodePath get_node_path () const
 Retrieves a previously attached NodePath. More...
 
unsigned int get_num_shapes () const
 
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. More...
 
PhysxSceneget_scene () const
 Retrieves the scene which this actor belongs to. More...
 
PhysxShapeget_shape (unsigned int idx) const
 
PhysxShapeget_shape_by_name (const char *name) const
 Retrieves an individual shape from the actor's array of shapes. More...
 
float get_sleep_angular_velocity () const
 Returns the angular velocity below which an actor may go to sleep. More...
 
float get_sleep_energy_threshold () const
 Returns the energy below which an actor may go to sleep. More...
 
float get_sleep_linear_velocity () const
 Returns the linear velocity below which an actor may go to sleep. More...
 
virtual TypeHandle get_type () const
 
bool is_dynamic () const
 Returns true if the actor is dynamic. More...
 
bool is_sleeping () const
 Returns true if this body is sleeping. More...
 
void link (NxActor *ptr)
 
void link_controller (PhysxController *controller)
 
void ls () const
 
void ls (std::ostream &out, int indent_level=0) const
 
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. More...
 
void move_global_mat (const LMatrix4f &mat)
 The move_global_* calls serve to move kinematically controlled dynamic actors through the game world. More...
 
void move_global_pos (const LPoint3f &pos)
 The move_global_* calls serve to move kinematically controlled dynamic actors through the game world. More...
 
NxActor * ptr () const
 
void put_to_sleep ()
 Forces the actor to sleep. More...
 
void release ()
 
bool save_body_to_desc (PhysxBodyDesc &bodyDesc) const
 Saves the body information of a dynamic actor to the passed body descriptor. More...
 
void save_to_desc (PhysxActorDesc &actorDesc) const
 Saves the state of the actor to the passed descriptor. More...
 
void set_actor_flag (PhysxActorFlag flag, bool value)
 Raise or lower individual ActorFlag flags. More...
 
void set_angular_damping (float angDamp)
 Sets the angular damping coefficient. More...
 
void set_angular_momentum (const LVector3f &momentum)
 Sets the angular momentum of the actor. More...
 
void set_angular_velocity (const LVector3f &angVel)
 Sets the angular velocity of the actor. More...
 
void set_body_flag (PhysxBodyFlag flag, bool value)
 Raise or lower individual BodyFlag flags. More...
 
void set_c_mass_global_mat (const LMatrix4f &mat)
 Moves the actor by setting the transform of the center of mass. More...
 
void set_c_mass_global_orientation (const LMatrix3f &mat)
 Moves the actor by setting the orientation of the center of mass. More...
 
void set_c_mass_global_pos (const LPoint3f &pos)
 Moves the actor by setting the position of the center of mass. More...
 
void set_c_mass_offset_global_mat (const LMatrix4f &mat)
 Sets the matrix of the center of mass relative to world space. More...
 
void set_c_mass_offset_global_orientation (const LMatrix3f &mat)
 Sets the orientation of the center of mass relative to world space. More...
 
void set_c_mass_offset_global_pos (const LPoint3f &pos)
 Sets the position of the center of mass relative to world space. More...
 
void set_c_mass_offset_local_mat (const LMatrix4f &mat)
 Sets the matrix of the center of mass relative to the actor. More...
 
void set_c_mass_offset_local_orientation (const LMatrix3f &mat)
 Sets the orientation of the center of mass relative to the actor. More...
 
void set_c_mass_offset_local_pos (const LPoint3f &pos)
 Sets the position of the center of mass relative to the actor. More...
 
void set_contact_report_flag (PhysxContactPairFlag flag, bool value)
 Sets the actor's contact report flags. More...
 
void set_contact_report_threshold (float threshold)
 Sets the force threshold for contact reports. More...
 
void set_dominance_group (unsigned int group)
 Assigns dynamic actors a dominance group identifier. More...
 
void set_global_hpr (float h, float p, float r)
 Method for setting a dynamic actor's orientation in the world. More...
 
void set_global_mat (const LMatrix4f &mat)
 Method for setting a dynamic actor's transform matrix in the world. More...
 
void set_global_pos (const LPoint3f &pos)
 Method for setting a dynamic actor's position in the world. More...
 
void set_group (unsigned int group)
 Assigns the actor to a user defined group of actors. More...
 
void set_linear_damping (float linDamp)
 Sets the linear damping coefficient. More...
 
void set_linear_momentum (const LVector3f &momentum)
 Sets the linear momentum of the actor. More...
 
void set_linear_velocity (const LVector3f &linVel)
 Sets the linear velocity of the actor. More...
 
void set_mass (float mass)
 Sets the mass of a dynamic actor. More...
 
void set_mass_space_inertia_tensor (const LVector3f &m)
 Sets the inertia tensor, using a parameter specified in mass space coordinates. More...
 
void set_max_angular_velocity (float maxAngVel)
 Lets you set the maximum angular velocity permitted for this actor. More...
 
void set_name (const char *name)
 Sets a name string for the object that can be retrieved with get_name(). More...
 
void set_shape_group (unsigned int group)
 Sets the collision group for all shapes of this actor. More...
 
void set_sleep_angular_velocity (float threshold)
 Sets the angular velocity below which an actor may go to sleep. More...
 
void set_sleep_energy_threshold (float threshold)
 Sets the energy threshold below which an actor may go to sleep. More...
 
void set_sleep_linear_velocity (float threshold)
 Sets the linear velocity below which an actor may go to sleep. More...
 
void unlink ()
 
bool update_mass_from_shapes (float density, float totalMass)
 Recomputes a dynamic actor's mass properties from its shapes. More...
 
void update_transform (const LMatrix4f &m)
 Updates the transform of an assigned NodePath. More...
 
void wake_up (float wakeCounterValue=NX_SLEEP_INTERVAL)
 Wakes up the actor if it is sleeping. More...
 
- Public Member Functions inherited from TypedReferenceCount
 TypedReferenceCount (const TypedReferenceCount &copy)
 
void operator= (const TypedReferenceCount &copy)
 
- Public Member Functions inherited from TypedObject
 TypedObject (const TypedObject &copy)=default
 
TypedObjectas_typed_object ()
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
const TypedObjectas_typed_object () const
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
int get_best_parent_from_Set (const std::set< int > &) const
 
int get_type_index () const
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
 
bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly. More...
 
bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type. More...
 
TypedObjectoperator= (const TypedObject &copy)=default
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 
WeakReferenceListget_weak_list () const
 Returns the WeakReferenceList associated with this ReferenceCount object. More...
 
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More...
 
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More...
 
void ref () const
 Explicitly increments the reference count. More...
 
bool ref_if_nonzero () const
 Atomically increases the reference count of this object if it is not zero. More...
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool test_ref_count_nonzero () const
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
virtual bool unref () const
 Explicitly decrements the reference count. More...
 
WeakReferenceListweak_ref ()
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref ()
 Removes the indicated PointerToVoid as a weak reference to this object. More...
 

Static Public Member Functions

static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from PhysxObject
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from TypedReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from TypedObject
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. More...
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 

Public Attributes

PhysxObjectCollection< PhysxShape_shapes
 
 get_num_shapes
 Returns the number of shapes assigned to the actor. More...
 
 get_shape
 Retrieves an individual shape from the actor's array of shapes. More...
 
- Public Attributes inherited from TypedObject
 get_type
 
- Public Attributes inherited from ReferenceCount
 get_ref_count
 Returns the current reference count. More...
 

Additional Inherited Members

- Public Types inherited from PhysxEnums
enum  PhysxActorFlag {
  AF_disable_collision = NX_AF_DISABLE_COLLISION, AF_disable_response = NX_AF_DISABLE_RESPONSE, AF_lock_com = NX_AF_LOCK_COM, AF_fluid_disable_collision = NX_AF_FLUID_DISABLE_COLLISION,
  AF_contact_modification = NX_AF_CONTACT_MODIFICATION, AF_force_cone_friction = NX_AF_FORCE_CONE_FRICTION, AF_user_actor_pair_filtering = NX_AF_USER_ACTOR_PAIR_FILTERING
}
 
enum  PhysxBodyFlag {
  BF_disable_gravity = NX_BF_DISABLE_GRAVITY, Bf_frozen_pos_x = NX_BF_FROZEN_POS_X, BF_frozen_pos_y = NX_BF_FROZEN_POS_Y, BF_frozen_pos_z = NX_BF_FROZEN_POS_Z,
  BF_frozen_rot_x = NX_BF_FROZEN_ROT_X, BF_frozen_rot_y = NX_BF_FROZEN_ROT_Y, BF_frozen_rot_z = NX_BF_FROZEN_ROT_Z, BF_frozen_pos = NX_BF_FROZEN_POS,
  BF_frozen_rot = NX_BF_FROZEN_ROT, BF_frozen = NX_BF_FROZEN, BF_kinematic = NX_BF_KINEMATIC, BF_visualization = NX_BF_VISUALIZATION,
  BF_filter_sleep_vel = NX_BF_FILTER_SLEEP_VEL, BF_energy_sleep_test = NX_BF_ENERGY_SLEEP_TEST
}
 
enum  PhysxBroadPhaseType { BPT_sap_single = NX_BP_TYPE_SAP_SINGLE, BPT_sap_multi = NX_BP_TYPE_SAP_MULTI }
 
enum  PhysxClothFlag {
  CLF_pressure = NX_CLF_PRESSURE, CLF_static = NX_CLF_STATIC, CLF_disable_collision = NX_CLF_DISABLE_COLLISION, CLF_selfcollision = NX_CLF_SELFCOLLISION,
  CLF_visualization = NX_CLF_VISUALIZATION, CLF_gravity = NX_CLF_GRAVITY, CLF_bending = NX_CLF_BENDING, CLF_bending_ortho = NX_CLF_BENDING_ORTHO,
  CLF_damping = NX_CLF_DAMPING, CLF_collision_twoway = NX_CLF_COLLISION_TWOWAY, CLF_triangle_collision = NX_CLF_TRIANGLE_COLLISION, CLF_tearable = NX_CLF_TEARABLE,
  CLF_hardware = NX_CLF_HARDWARE, CLF_comdamping = NX_CLF_COMDAMPING, CLF_validbounds = NX_CLF_VALIDBOUNDS, CLF_fluid_collision = NX_CLF_FLUID_COLLISION,
  CLF_disable_dynamic_ccd = NX_CLF_DISABLE_DYNAMIC_CCD, CLF_adhere = NX_CLF_ADHERE
}
 
enum  PhysxCombineMode { CM_average = NX_CM_AVERAGE, CM_min = NX_CM_MIN, CM_multiply = NX_CM_MULTIPLY, CM_max = NX_CM_MAX }
 
enum  PhysxContactPairFlag {
  CPF_ignore_pair = NX_IGNORE_PAIR, CPF_notify_on_start_touch = NX_NOTIFY_ON_START_TOUCH, CPF_notify_on_end_touch = NX_NOTIFY_ON_END_TOUCH, CPF_notify_on_touch = NX_NOTIFY_ON_TOUCH,
  CPF_notify_on_impact = NX_NOTIFY_ON_IMPACT, CPF_notify_on_roll = NX_NOTIFY_ON_ROLL, CPF_notify_on_slide = NX_NOTIFY_ON_SLIDE, CPF_notify_forces = NX_NOTIFY_FORCES,
  CPF_notify_on_start_touch_threshold = NX_NOTIFY_ON_START_TOUCH_FORCE_THRESHOLD, CPF_notify_on_end_touch_threshold = NX_NOTIFY_ON_END_TOUCH_FORCE_THRESHOLD, CPF_notify_on_touch_threshold = NX_NOTIFY_ON_TOUCH_FORCE_THRESHOLD, CPF_notify_contact_modifications = NX_NOTIFY_CONTACT_MODIFICATION
}
 
enum  PhysxD6JointDriveType { D6_joint_drive_position = NX_D6JOINT_DRIVE_POSITION, D6_joint_drive_velocity = NX_D6JOINT_DRIVE_VELOCITY }
 
enum  PhysxD6JointFlag { D6_joint_slerp_drive = NX_D6JOINT_SLERP_DRIVE, D6_joint_gear_disabled = NX_D6JOINT_GEAR_ENABLED }
 
enum  PhysxD6JointMotion { D6_joint_motion_locked = NX_D6JOINT_MOTION_LOCKED, D6_joint_motion_limited = NX_D6JOINT_MOTION_LIMITED, D6_joint_motion_free = NX_D6JOINT_MOTION_FREE }
 
enum  PhysxDistanceJointFlag { DJF_max_distance_enabled = NX_DJF_MAX_DISTANCE_ENABLED, DJF_mix_distance_enabled = NX_DJF_MIN_DISTANCE_ENABLED, DJF_spring_enabled = NX_DJF_SPRING_ENABLED }
 
enum  PhysxFilterOp {
  FO_and = NX_FILTEROP_AND, FO_or = NX_FILTEROP_OR, FO_xor = NX_FILTEROP_XOR, FO_nand = NX_FILTEROP_NAND,
  FO_nor = NX_FILTEROP_NOR, FO_nxor = NX_FILTEROP_NXOR, FO_swap_and = NX_FILTEROP_SWAP_AND
}
 
enum  PhysxForceFieldCoordinates { FFC_cartesian, FFC_spherical, FFC_cylindrical, FFC_toroidal }
 
enum  PhysxForceFieldShapeGroupFlag { FFSG_exclude_group = NX_FFSG_EXCLUDE_GROUP }
 
enum  PhysxForceMode {
  FM_force = NX_FORCE, FM_impulse = NX_IMPULSE, FM_velocity_change = NX_VELOCITY_CHANGE, FM_smooth_impulse = NX_SMOOTH_IMPULSE,
  FM_smooth_velocity_change = NX_SMOOTH_VELOCITY_CHANGE, FM_acceleration = NX_ACCELERATION
}
 
enum  PhysxJointFlag { JF_collision_enabled = NX_JF_COLLISION_ENABLED, JF_visualization = NX_JF_VISUALIZATION }
 
enum  PhysxMaterialFlag { MF_anisotropic = NX_MF_ANISOTROPIC, MF_disable_friction = NX_MF_DISABLE_FRICTION, MF_disable_strong_friction = NX_MF_DISABLE_STRONG_FRICTION }
 
enum  PhysxParameter {
  P_penalty_force = NX_PENALTY_FORCE, P_skin_width = NX_SKIN_WIDTH, P_default_sleep_lin_vel_squared = NX_DEFAULT_SLEEP_LIN_VEL_SQUARED, P_default_sleep_ang_vel_squared = NX_DEFAULT_SLEEP_ANG_VEL_SQUARED,
  P_bounce_threshold = NX_BOUNCE_THRESHOLD, P_dyn_frict_scaling = NX_DYN_FRICT_SCALING, P_sta_frict_scaling = NX_STA_FRICT_SCALING, P_max_angular_velocity = NX_MAX_ANGULAR_VELOCITY,
  P_continuous_cd = NX_CONTINUOUS_CD, P_visualization_scale = NX_VISUALIZATION_SCALE, P_adaptive_force = NX_ADAPTIVE_FORCE, P_coll_veta_jointed = NX_COLL_VETO_JOINTED,
  P_trigger_trigger_callback = NX_TRIGGER_TRIGGER_CALLBACK, P_select_hw_algo = NX_SELECT_HW_ALGO, P_ccd_epsilon = NX_CCD_EPSILON, P_solver_convergence_threshold = NX_SOLVER_CONVERGENCE_THRESHOLD,
  P_bbox_noise_level = NX_BBOX_NOISE_LEVEL, P_implicit_sweep_cache_size = NX_IMPLICIT_SWEEP_CACHE_SIZE, P_default_sleep_energy = NX_DEFAULT_SLEEP_ENERGY, P_constant_fluid_max_packets = NX_CONSTANT_FLUID_MAX_PACKETS,
  P_constant_fluid_max_particles_per_step = NX_CONSTANT_FLUID_MAX_PARTICLES_PER_STEP, P_asynchronous_mesh_creation = NX_ASYNCHRONOUS_MESH_CREATION, P_force_field_custom_kernel_epsilon = NX_FORCE_FIELD_CUSTOM_KERNEL_EPSILON, P_improved_spring_solver = NX_IMPROVED_SPRING_SOLVER,
  P_visualize_world_axes = NX_VISUALIZE_WORLD_AXES, P_visualize_body_axes = NX_VISUALIZE_BODY_AXES, P_visualize_body_mass_axes = NX_VISUALIZE_BODY_MASS_AXES, P_visualize_body_lin_velocity = NX_VISUALIZE_BODY_LIN_VELOCITY,
  P_visualize_body_ang_velocity = NX_VISUALIZE_BODY_ANG_VELOCITY, P_visualize_body_joint_groups = NX_VISUALIZE_BODY_JOINT_GROUPS, P_visualize_joint_local_axes = NX_VISUALIZE_JOINT_LOCAL_AXES, P_visualize_joint_world_axes = NX_VISUALIZE_JOINT_WORLD_AXES,
  P_visualize_joint_limits = NX_VISUALIZE_JOINT_LIMITS, P_visualize_contact_point = NX_VISUALIZE_CONTACT_POINT, P_visualize_contact_normal = NX_VISUALIZE_CONTACT_NORMAL, P_visualize_contact_error = NX_VISUALIZE_CONTACT_ERROR,
  P_visualize_contact_force = NX_VISUALIZE_CONTACT_FORCE, P_visualize_actor_axes = NX_VISUALIZE_ACTOR_AXES, P_visualize_collision_aabbs = NX_VISUALIZE_COLLISION_AABBS, P_visualize_collision_shapes = NX_VISUALIZE_COLLISION_SHAPES,
  P_visualize_collision_axes = NX_VISUALIZE_COLLISION_AXES, P_visualize_collision_compounds = NX_VISUALIZE_COLLISION_COMPOUNDS, P_visualize_collision_vnormals = NX_VISUALIZE_COLLISION_VNORMALS, P_visualize_collision_fnormals = NX_VISUALIZE_COLLISION_FNORMALS,
  P_visualize_collision_edges = NX_VISUALIZE_COLLISION_EDGES, P_visualize_collision_spheres = NX_VISUALIZE_COLLISION_SPHERES, P_visualize_collision_static = NX_VISUALIZE_COLLISION_STATIC, P_visualize_collision_dynamic = NX_VISUALIZE_COLLISION_DYNAMIC,
  P_visualize_collision_free = NX_VISUALIZE_COLLISION_FREE, P_visualize_collision_ccd = NX_VISUALIZE_COLLISION_CCD, P_visualize_collision_skeletons = NX_VISUALIZE_COLLISION_SKELETONS, P_visualize_fluid_emitters = NX_VISUALIZE_FLUID_EMITTERS,
  P_visualize_fluid_position = NX_VISUALIZE_FLUID_POSITION, P_visualize_fluid_velocity = NX_VISUALIZE_FLUID_VELOCITY, P_visualize_fluid_kernel_radius = NX_VISUALIZE_FLUID_KERNEL_RADIUS, P_visualize_fluid_bounds = NX_VISUALIZE_FLUID_BOUNDS,
  P_visualize_fluid_packets = NX_VISUALIZE_FLUID_PACKETS, P_visualize_fluid_motion_limit = NX_VISUALIZE_FLUID_MOTION_LIMIT, P_visualize_fluid_dyn_collision = NX_VISUALIZE_FLUID_DYN_COLLISION, P_visualize_fluid_stc_collision = NX_VISUALIZE_FLUID_STC_COLLISION,
  P_visualize_fluid_mesh_packets = NX_VISUALIZE_FLUID_MESH_PACKETS, P_visualize_fluid_drains = NX_VISUALIZE_FLUID_DRAINS, P_visualize_fluid_packet_data = NX_VISUALIZE_FLUID_PACKET_DATA, P_visualize_cloth_mesh = NX_VISUALIZE_CLOTH_MESH,
  P_visualize_cloth_collisions = NX_VISUALIZE_CLOTH_COLLISIONS, P_visualize_cloth_selfcollisions = NX_VISUALIZE_CLOTH_SELFCOLLISIONS, P_visualize_cloth_workpackets = NX_VISUALIZE_CLOTH_WORKPACKETS, P_visualize_cloth_sleep = NX_VISUALIZE_CLOTH_SLEEP,
  P_visualize_cloth_sleep_vertex = NX_VISUALIZE_CLOTH_SLEEP_VERTEX, P_visualize_cloth_tearable_vertices = NX_VISUALIZE_CLOTH_TEARABLE_VERTICES, P_visualize_cloth_tearing = NX_VISUALIZE_CLOTH_TEARING, P_visualize_cloth_attachment = NX_VISUALIZE_CLOTH_ATTACHMENT,
  P_visualize_cloth_validbounds = NX_VISUALIZE_CLOTH_VALIDBOUNDS, P_visualize_softbody_mesh = NX_VISUALIZE_SOFTBODY_MESH, P_visualize_softbody_collisions = NX_VISUALIZE_SOFTBODY_COLLISIONS, P_visualize_softbody_workpackets = NX_VISUALIZE_SOFTBODY_WORKPACKETS,
  P_visualize_softbody_sleep = NX_VISUALIZE_SOFTBODY_SLEEP, P_visualize_softbody_sleep_vertex = NX_VISUALIZE_SOFTBODY_SLEEP_VERTEX, P_visualize_softbody_tearable_vertices = NX_VISUALIZE_SOFTBODY_TEARABLE_VERTICES, P_visualize_softbody_tearing = NX_VISUALIZE_SOFTBODY_TEARING,
  P_visualize_softbody_attachment = NX_VISUALIZE_SOFTBODY_ATTACHMENT, P_visualize_softbody_validbounds = NX_VISUALIZE_SOFTBODY_VALIDBOUNDS, P_visualize_active_vertices = NX_VISUALIZE_ACTIVE_VERTICES, P_visualize_force_fields = NX_VISUALIZE_FORCE_FIELDS
}
 
enum  PhysxProjectionMode { PM_none = NX_JPM_NONE, PM_point_mindist = NX_JPM_POINT_MINDIST, PM_linear_mindist = NX_JPM_LINEAR_MINDIST }
 
enum  PhysxPruningStructure {
  PS_none = NX_PRUNING_NONE, PS_octree = NX_PRUNING_OCTREE, PS_quadtree = NX_PRUNING_QUADTREE, PS_dynamic_aabb_tree = NX_PRUNING_DYNAMIC_AABB_TREE,
  PS_static_aabb_tree = NX_PRUNING_STATIC_AABB_TREE
}
 
enum  PhysxPulleyJointFlag { PJF_is_rigid = NX_PJF_IS_RIGID, PJF_motor_enabled = NX_PJF_MOTOR_ENABLED }
 
enum  PhysxRevoluteJointFlag { RJF_limit_enabled = NX_RJF_LIMIT_ENABLED, RJF_motor_enabled = NX_RJF_MOTOR_ENABLED, RJF_spring_enabled = NX_RJF_SPRING_ENABLED }
 
enum  PhysxSceneFlag {
  SF_disable_sse = NX_SF_DISABLE_SSE, SF_disable_collisions = NX_SF_DISABLE_COLLISIONS, SF_restricted_scene = NX_SF_RESTRICTED_SCENE, SF_disable_scene_mutex = NX_SF_DISABLE_SCENE_MUTEX,
  SF_force_cone_friction = NX_SF_FORCE_CONE_FRICTION, SF_sequential_primary = NX_SF_SEQUENTIAL_PRIMARY, SF_fluid_performance_hint = NX_SF_FLUID_PERFORMANCE_HINT
}
 
enum  PhysxShapeFlag {
  SF_trigger_on_enter = NX_TRIGGER_ON_ENTER, SF_trigger_on_leave = NX_TRIGGER_ON_LEAVE, SF_trigger_on_stay = NX_TRIGGER_ON_STAY, SF_trigger_enable = NX_TRIGGER_ENABLE,
  SF_visualization = NX_SF_VISUALIZATION, SF_disable_collision = NX_SF_DISABLE_COLLISION, SF_disable_raycasting = NX_SF_DISABLE_RAYCASTING, SF_disable_response = NX_SF_DISABLE_RESPONSE,
  SF_disable_scene_queries = NX_SF_DISABLE_SCENE_QUERIES, SF_point_contact_force = NX_SF_POINT_CONTACT_FORCE, SF_feature_indices = NX_SF_FEATURE_INDICES, SF_dynamic_dynamic_ccd = NX_SF_DYNAMIC_DYNAMIC_CCD,
  SF_fluid_drain = NX_SF_FLUID_DRAIN, SF_fluid_disable_collision = NX_SF_FLUID_DISABLE_COLLISION, SF_fluid_twoway = NX_SF_FLUID_TWOWAY, SF_cloth_drain = NX_SF_CLOTH_DRAIN,
  SF_cloth_disable_collision = NX_SF_CLOTH_DISABLE_COLLISION, SF_cloth_twoway = NX_SF_CLOTH_TWOWAY, SF_softbody_drain = NX_SF_SOFTBODY_DRAIN, SF_softbody_disable_collision = NX_SF_SOFTBODY_DISABLE_COLLISION,
  SF_softbody_twoway = NX_SF_SOFTBODY_TWOWAY
}
 
enum  PhysxShapesType { ST_static = NX_STATIC_SHAPES, ST_dynamic = NX_DYNAMIC_SHAPES, ST_all = NX_ALL_SHAPES }
 
enum  PhysxSoftBodyFlag {
  SBF_static = NX_SBF_STATIC, SBF_disable_collision = NX_SBF_DISABLE_COLLISION, SBF_selfcollision = NX_SBF_SELFCOLLISION, SBF_visualization = NX_SBF_VISUALIZATION,
  SBF_gravity = NX_SBF_GRAVITY, SBF_volume_conservtion = NX_SBF_VOLUME_CONSERVATION, SBF_damping = NX_SBF_DAMPING, SBF_collision_twoway = NX_SBF_COLLISION_TWOWAY,
  SBF_tearable = NX_SBF_TEARABLE, SBF_hardware = NX_SBF_HARDWARE, SBF_comdamping = NX_SBF_COMDAMPING, SBF_validbounds = NX_SBF_VALIDBOUNDS,
  SBF_fluid_collision = NX_SBF_FLUID_COLLISION, SBF_disable_dynamic_ccd = NX_SBF_DISABLE_DYNAMIC_CCD, SBF_adhere = NX_SBF_ADHERE
}
 
enum  PhysxSphericalJointFlag {
  SJF_twist_limit_enabled = NX_SJF_TWIST_LIMIT_ENABLED, SJF_swing_limit_enabled = NX_SJF_SWING_LIMIT_ENABLED, SJF_twist_spring_enabled = NX_SJF_TWIST_SPRING_ENABLED, SJF_swing_spring_enabled = NX_SJF_SWING_SPRING_ENABLED,
  SJF_joint_spring_enabled = NX_SJF_JOINT_SPRING_ENABLED, SJF_perpendicular_dir_constraints = NX_SJF_PERPENDICULAR_DIR_CONSTRAINTS
}
 
enum  PhysxUpAxis { X_up = NX_X, Y_up = NX_Y, Z_up = NX_Z }
 
enum  PhysxVertexAttachmentStatus { VAS_none = NX_CLOTH_VERTEX_ATTACHMENT_NONE, VAS_global = NX_CLOTH_VERTEX_ATTACHMENT_GLOBAL, VAS_shape = NX_CLOTH_VERTEX_ATTACHMENT_SHAPE }
 
enum  PhysxWheelFlag { WF_steerable_input = 1<<0, WF_steerable_auto = 1<<1, WF_affected_by_handbrake = 1<<2, WF_accelerated = 1<<3 }
 
enum  PhysxWheelShapeFlag {
  WSF_wheel_axis_contact_normal = NX_WF_WHEEL_AXIS_CONTACT_NORMAL, WSF_input_lat_slipvelocity = NX_WF_INPUT_LAT_SLIPVELOCITY, WSF_input_lng_slipvelocity = NX_WF_INPUT_LNG_SLIPVELOCITY, WSF_unscaled_spring_behavior = NX_WF_UNSCALED_SPRING_BEHAVIOR,
  WSF_axle_speed_override = NX_WF_AXLE_SPEED_OVERRIDE, WSF_emulate_legacy_wheel = NX_WF_EMULATE_LEGACY_WHEEL, WSF_clamped_friction = NX_WF_CLAMPED_FRICTION
}
 

Detailed Description

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 44 of file physxActor.h.

Member Function Documentation

◆ add_force()

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 458 of file physxActor.cxx.

◆ add_force_at_local_pos()

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 505 of file physxActor.cxx.

◆ add_force_at_pos()

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 481 of file physxActor.cxx.

◆ add_local_force()

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 542 of file physxActor.cxx.

◆ add_local_force_at_local_pos()

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 589 of file physxActor.cxx.

◆ add_local_force_at_pos()

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 565 of file physxActor.cxx.

◆ add_local_torque()

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 608 of file physxActor.cxx.

◆ add_torque()

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 524 of file physxActor.cxx.

◆ attach_node_path()

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 323 of file physxActor.cxx.

◆ compute_kinetic_energy()

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 654 of file physxActor.cxx.

◆ create_shape()

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 388 of file physxActor.cxx.

◆ detach_node_path()

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 336 of file physxActor.cxx.

◆ get_actor_flag()

bool PhysxActor::get_actor_flag ( PhysxActorFlag  flag) const

Return the specified ActorFlag flag.

Definition at line 730 of file physxActor.cxx.

◆ get_angular_damping()

float PhysxActor::get_angular_damping ( ) const

Returns the angular damping coefficient.

The actor must be dynamic.

Definition at line 859 of file physxActor.cxx.

◆ get_angular_momentum()

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 1059 of file physxActor.cxx.

◆ get_angular_velocity()

LVector3f PhysxActor::get_angular_velocity ( ) const

Returns the angular velocity of the actor.

The actor must be dynamic.

Definition at line 967 of file physxActor.cxx.

◆ get_body_flag()

bool PhysxActor::get_body_flag ( PhysxBodyFlag  flag) const

Return the specified BodyFlag flag.

Definition at line 706 of file physxActor.cxx.

◆ get_c_mass_global_mat()

LMatrix4f PhysxActor::get_c_mass_global_mat ( ) const

Returns the center of mass transform in world space.

Definition at line 1325 of file physxActor.cxx.

◆ get_c_mass_global_orientation()

LMatrix3f PhysxActor::get_c_mass_global_orientation ( ) const

Returns the center of mass orientation in world space.

Definition at line 1345 of file physxActor.cxx.

◆ get_c_mass_global_pos()

LPoint3f PhysxActor::get_c_mass_global_pos ( ) const

Returns the center of mass position in world space.

Definition at line 1335 of file physxActor.cxx.

◆ get_c_mass_local_mat()

LMatrix4f PhysxActor::get_c_mass_local_mat ( ) const

Returns the center of mass transform relative to the actor.

Definition at line 1355 of file physxActor.cxx.

◆ get_c_mass_local_orientation()

LMatrix3f PhysxActor::get_c_mass_local_orientation ( ) const

Returns the center of mass orientation relative to the actor.

Definition at line 1375 of file physxActor.cxx.

◆ get_c_mass_local_pos()

LPoint3f PhysxActor::get_c_mass_local_pos ( ) const

Returns the center of mass position relative to the actor.

Definition at line 1365 of file physxActor.cxx.

◆ get_dominance_group()

unsigned int PhysxActor::get_dominance_group ( ) const

Retrieves the dominance group of this actor.

Definition at line 834 of file physxActor.cxx.

◆ get_global_inertia_tensor()

LMatrix3f PhysxActor::get_global_inertia_tensor ( ) const

Returns the inertia tensor of the actor relative to the world coordinate frame.

Definition at line 1397 of file physxActor.cxx.

◆ get_global_inertia_tensor_inverse()

LMatrix3f PhysxActor::get_global_inertia_tensor_inverse ( ) const

Returns the inverse of the inertia tensor of the actor relative to the world coordinate frame.

Definition at line 1408 of file physxActor.cxx.

◆ get_global_mat()

LMatrix4f PhysxActor::get_global_mat ( ) const

Retrieves the actors world space transform.

Definition at line 177 of file physxActor.cxx.

◆ get_global_pos()

LPoint3f PhysxActor::get_global_pos ( ) const

Retrieves the actors world space position.

Definition at line 167 of file physxActor.cxx.

◆ get_global_quat()

LQuaternionf PhysxActor::get_global_quat ( ) const

Retrieves the actors world space orientation.

Definition at line 187 of file physxActor.cxx.

◆ get_group()

unsigned int PhysxActor::get_group ( ) const

Retrieves the actor group this actor is assigned to.

Definition at line 801 of file physxActor.cxx.

◆ get_linear_damping()

float PhysxActor::get_linear_damping ( ) const

Retrieves the linear damping coefficient.

The actor must be dynamic.

Definition at line 883 of file physxActor.cxx.

◆ get_linear_momentum()

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 1047 of file physxActor.cxx.

◆ get_linear_velocity()

LVector3f PhysxActor::get_linear_velocity ( ) const

Returns the linear velocity of an actor.

The actor must be dynamic.

Definition at line 957 of file physxActor.cxx.

◆ get_local_point_velocity()

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 1006 of file physxActor.cxx.

◆ get_mass()

float PhysxActor::get_mass ( ) const

Returns the mass of the actor.

Definition at line 1214 of file physxActor.cxx.

◆ get_mass_space_inertia_tensor()

LVector3f PhysxActor::get_mass_space_inertia_tensor ( ) const

Returns the diagonal inertia tensor of the actor relative to the mass coordinate frame.

Definition at line 1386 of file physxActor.cxx.

◆ get_max_angular_velocity()

float PhysxActor::get_max_angular_velocity ( ) const

Returns the maximum angular velocity permitted for this actor.

Definition at line 977 of file physxActor.cxx.

◆ get_name()

const char * PhysxActor::get_name ( ) const

Retrieves the name string.

Definition at line 131 of file physxActor.cxx.

◆ get_node_path()

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 348 of file physxActor.cxx.

◆ get_point_velocity()

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 990 of file physxActor.cxx.

◆ get_scene()

PhysxScene * PhysxActor::get_scene ( ) const

Retrieves the scene which this actor belongs to.

Definition at line 359 of file physxActor.cxx.

◆ get_shape_by_name()

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 427 of file physxActor.cxx.

◆ get_sleep_angular_velocity()

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 1132 of file physxActor.cxx.

◆ get_sleep_energy_threshold()

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 1144 of file physxActor.cxx.

◆ get_sleep_linear_velocity()

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 1120 of file physxActor.cxx.

◆ is_dynamic()

bool PhysxActor::is_dynamic ( ) const

Returns true if the actor is dynamic.

Definition at line 664 of file physxActor.cxx.

◆ is_sleeping()

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 1162 of file physxActor.cxx.

◆ move_global_hpr()

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 306 of file physxActor.cxx.

◆ move_global_mat()

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 289 of file physxActor.cxx.

◆ move_global_pos()

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 261 of file physxActor.cxx.

◆ put_to_sleep()

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 1194 of file physxActor.cxx.

◆ save_body_to_desc()

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 98 of file physxActor.cxx.

◆ save_to_desc()

void PhysxActor::save_to_desc ( PhysxActorDesc actorDesc) const

Saves the state of the actor to the passed descriptor.

Definition at line 108 of file physxActor.cxx.

◆ set_actor_flag()

void PhysxActor::set_actor_flag ( PhysxActorFlag  flag,
bool  value 
)

Raise or lower individual ActorFlag flags.

Definition at line 716 of file physxActor.cxx.

◆ set_angular_damping()

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 847 of file physxActor.cxx.

◆ set_angular_momentum()

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 1036 of file physxActor.cxx.

◆ set_angular_velocity()

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 917 of file physxActor.cxx.

◆ set_body_flag()

void PhysxActor::set_body_flag ( PhysxBodyFlag  flag,
bool  value 
)

Raise or lower individual BodyFlag flags.

Definition at line 692 of file physxActor.cxx.

◆ set_c_mass_global_mat()

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 1284 of file physxActor.cxx.

◆ set_c_mass_global_orientation()

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 1304 of file physxActor.cxx.

◆ set_c_mass_global_pos()

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 1294 of file physxActor.cxx.

◆ set_c_mass_offset_global_mat()

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 1254 of file physxActor.cxx.

◆ set_c_mass_offset_global_orientation()

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 1274 of file physxActor.cxx.

◆ set_c_mass_offset_global_pos()

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 1264 of file physxActor.cxx.

◆ set_c_mass_offset_local_mat()

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 1224 of file physxActor.cxx.

◆ set_c_mass_offset_local_orientation()

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 1244 of file physxActor.cxx.

◆ set_c_mass_offset_local_pos()

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 1234 of file physxActor.cxx.

◆ set_contact_report_flag()

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 748 of file physxActor.cxx.

◆ set_contact_report_threshold()

void PhysxActor::set_contact_report_threshold ( float  threshold)

Sets the force threshold for contact reports.

The actor must be dynamic.

Definition at line 768 of file physxActor.cxx.

◆ set_dominance_group()

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 821 of file physxActor.cxx.

◆ set_global_hpr()

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 243 of file physxActor.cxx.

◆ set_global_mat()

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: - Move actors into other actors, thus causing interpenetration (an invalid physical state). - Move an actor that is connected by a joint to another away from the other (thus causing joint error). - When moving jointed actors the joints' cached transform information is destroyed and recreated next frame; thus this call is expensive for jointed actors.

Definition at line 230 of file physxActor.cxx.

◆ set_global_pos()

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 198 of file physxActor.cxx.

◆ set_group()

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 789 of file physxActor.cxx.

◆ set_linear_damping()

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 871 of file physxActor.cxx.

◆ set_linear_momentum()

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 1023 of file physxActor.cxx.

◆ set_linear_velocity()

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 899 of file physxActor.cxx.

◆ set_mass()

void PhysxActor::set_mass ( float  mass)

Sets the mass of a dynamic actor.

Definition at line 1204 of file physxActor.cxx.

◆ set_mass_space_inertia_tensor()

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 1315 of file physxActor.cxx.

◆ set_max_angular_velocity()

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 945 of file physxActor.cxx.

◆ set_name()

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 119 of file physxActor.cxx.

◆ set_shape_group()

void PhysxActor::set_shape_group ( unsigned int  group)

Sets the collision group for all shapes of this actor.

See PhysxShape.setGroup().

Definition at line 675 of file physxActor.cxx.

◆ set_sleep_angular_velocity()

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 1091 of file physxActor.cxx.

◆ set_sleep_energy_threshold()

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 1108 of file physxActor.cxx.

◆ set_sleep_linear_velocity()

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 1075 of file physxActor.cxx.

◆ update_mass_from_shapes()

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 643 of file physxActor.cxx.

◆ update_transform()

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 143 of file physxActor.cxx.

References NodePath::get_top(), NodePath::is_empty(), and NodePath::set_transform().

◆ wake_up()

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 1178 of file physxActor.cxx.

Member Data Documentation

◆ get_num_shapes

unsigned int PhysxActor::get_num_shapes

Returns the number of shapes assigned to the actor.

Definition at line 90 of file physxActor.h.

◆ get_shape

PhysxShape * PhysxActor::get_shape

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 90 of file physxActor.h.


The documentation for this class was generated from the following files: