Panda3D
Public Member Functions | Static Public Member Functions
PhysxJoint Class Reference

Abstract base class for the different types of joints. More...

#include "physxJoint.h"

Inheritance diagram for PhysxJoint:
PhysxObject PhysxEnums TypedReferenceCount TypedObject ReferenceCount MemoryBase MemoryBase PhysxCylindricalJoint PhysxD6Joint PhysxDistanceJoint PhysxFixedJoint PhysxPointInPlaneJoint PhysxPointOnLineJoint PhysxPrismaticJoint PhysxPulleyJoint PhysxRevoluteJoint PhysxSphericalJoint

List of all members.

Public Member Functions

void add_limit_plane (const LVector3f &normal, const LPoint3f &pointInPlane, float restitution=0.0f)
 Adds a limit plane.
virtual TypeHandle force_init_type ()
PhysxActorget_actor (unsigned int idx) const
 Retrieves the actor which this joint is associated with.
LPoint3f get_global_anchor () const
 Retrieves the joint anchor.
LVector3f get_global_axis () const
 Retrieves the joint axis.
const char * get_name () const
 Returns the name string.
PhysxSceneget_scene () const
 Retrieves the scene which this joint is associated with.
float get_solver_extrapolation_factor () const
 Retrieves the solver extrapolation factor.
virtual TypeHandle get_type () const
bool get_use_acceleration_spring () const
 Checks whether acceleration spring is used.
virtual void link (NxJoint *shapePtr)=0
void ls () const
void ls (ostream &out, int indent_level=0) const
virtual NxJoint * ptr () const =0
void purge_limit_planes ()
 Deletes all limit planes added to the joint.
void release ()
void set_breakable (float maxForce, float maxTorque)
 Sets the maximum force magnitude that the joint is able to withstand without breaking.
void set_global_anchor (const LPoint3f &anchor)
 Sets the point where the two actors are attached, specified in global coordinates.
void set_global_axis (const LVector3f &axis)
 Sets the direction of the joint's primary axis, specified in global coordinates.
void set_limit_point (const LPoint3f &pos, bool isOnActor2=true)
 Sets the limit point.
void set_name (const char *name)
 Sets a name string for this object.
void set_solver_extrapolation_factor (float factor)
 Sets the solver extrapolation factor.
void set_use_acceleration_spring (bool value)
 Switch between acceleration and force based spring.
virtual void unlink ()=0

Static Public Member Functions

static PhysxJointfactory (NxJointType shapeType)
static TypeHandle get_class_type ()
static void init_type ()
 This function is declared non-inline to work around a compiler bug in g++ 2.96.

Detailed Description

Abstract base class for the different types of joints.

All joints are used to connect two dynamic actors, or an actor and the environment.

Definition at line 35 of file physxJoint.h.


Member Function Documentation

void PhysxJoint::add_limit_plane ( const LVector3f normal,
const LPoint3f pointInPlane,
float  restitution = 0.0f 
)

Adds a limit plane.

The parameters are given in global coordinates. The plane is affixed to the actor that does not have the limit point.

The normal of the plane points toward the positive side of the plane, and thus toward the limit point. If the normal points away from the limit point at the time of this call, the method returns false and the limit plane is ignored.

Definition at line 329 of file physxJoint.cxx.

References PhysxManager::point3_to_nxVec3(), and PhysxManager::vec3_to_nxVec3().

PhysxActor * PhysxJoint::get_actor ( unsigned int  idx) const

Retrieves the actor which this joint is associated with.

Definition at line 127 of file physxJoint.cxx.

Retrieves the joint anchor.

Definition at line 169 of file physxJoint.cxx.

References PhysxManager::nxVec3_to_point3(), and LPoint3f::zero().

Retrieves the joint axis.

Definition at line 194 of file physxJoint.cxx.

References PhysxManager::nxVec3_to_vec3(), and LVector3f::zero().

const char * PhysxJoint::get_name ( ) const

Returns the name string.

Definition at line 114 of file physxJoint.cxx.

Retrieves the scene which this joint is associated with.

Definition at line 144 of file physxJoint.cxx.

Retrieves the solver extrapolation factor.

Definition at line 276 of file physxJoint.cxx.

Checks whether acceleration spring is used.

Definition at line 252 of file physxJoint.cxx.

static void PhysxJoint::init_type ( ) [inline, static]

Deletes all limit planes added to the joint.

Definition at line 343 of file physxJoint.cxx.

void PhysxJoint::set_breakable ( float  maxForce,
float  maxTorque 
)

Sets the maximum force magnitude that the joint is able to withstand without breaking.

If the joint force rises above this threshold, the joint breaks, and becomes disabled.

There are two values, one for linear forces, and one for angular forces. Both values are used directly as a value for the maximum impulse tolerated by the joint constraints.

Both force values are NX_MAX_REAL by default. This setting makes the joint unbreakable. The values should always be nonnegative.

The distinction between maxForce and maxTorque is dependent on how the joint is implemented internally, which may not be obvious. For example what appears to be an angular degree of freedom may be constrained indirectly by a linear constraint.

So in most practical applications the user should set both maxTorque and maxForce to low values.

Definition at line 228 of file physxJoint.cxx.

void PhysxJoint::set_global_anchor ( const LPoint3f anchor)

Sets the point where the two actors are attached, specified in global coordinates.

Definition at line 157 of file physxJoint.cxx.

References PhysxManager::point3_to_nxVec3().

void PhysxJoint::set_global_axis ( const LVector3f axis)

Sets the direction of the joint's primary axis, specified in global coordinates.

Definition at line 182 of file physxJoint.cxx.

References PhysxManager::vec3_to_nxVec3().

void PhysxJoint::set_limit_point ( const LPoint3f pos,
bool  isOnActor2 = true 
)

Sets the limit point.

The point is specified in the global coordinate frame.

All types of joints may be limited with the same system: You may elect a point attached to one of the two actors to act as the limit point. You may also specify several planes attached to the other actor.

The points and planes move together with the actor they are attached to.

The simulation then makes certain that the pair of actors only move relative to each other so that the limit point stays on the positive side of all limit planes.

The default limit point is (0,0,0) in the local frame of actor2. Calling this deletes all existing limit planes

Definition at line 308 of file physxJoint.cxx.

References PhysxManager::point3_to_nxVec3().

void PhysxJoint::set_name ( const char *  name)

Sets a name string for this object.

The name can be retrieved again with get_name(). This is for debugging and is not used by the physics engine.

Definition at line 100 of file physxJoint.cxx.

Sets the solver extrapolation factor.

Definition at line 264 of file physxJoint.cxx.

Switch between acceleration and force based spring.

Definition at line 240 of file physxJoint.cxx.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations