15 #include "physxJoint.h" 16 #include "physxManager.h" 17 #include "physxActor.h" 18 #include "physxScene.h" 19 #include "physxCylindricalJoint.h" 20 #include "physxDistanceJoint.h" 21 #include "physxFixedJoint.h" 22 #include "physxPointInPlaneJoint.h" 23 #include "physxPointOnLineJoint.h" 24 #include "physxPrismaticJoint.h" 25 #include "physxPulleyJoint.h" 26 #include "physxRevoluteJoint.h" 27 #include "physxSphericalJoint.h" 28 #include "physxD6Joint.h" 40 nassertv(_error_type == ET_ok);
43 ptr()->getScene().releaseJoint(*ptr());
52 factory(NxJointType shapeType) {
56 case NX_JOINT_PRISMATIC:
59 case NX_JOINT_REVOLUTE:
62 case NX_JOINT_CYLINDRICAL:
65 case NX_JOINT_SPHERICAL:
68 case NX_JOINT_POINT_ON_LINE:
71 case NX_JOINT_POINT_IN_PLANE:
74 case NX_JOINT_DISTANCE:
87 physx_cat.error() <<
"Unknown joint type.\n";
102 nassertv(_error_type == ET_ok);
104 _name = name ? name :
"";
105 ptr()->setName(_name.c_str());
116 nassertr(_error_type == ET_ok,
"");
117 return ptr()->getName();
129 nassertr_always(idx < 2, NULL);
130 nassertr(_error_type == ET_ok, NULL);
132 NxActor *actorPtr[2];
133 ptr()->getActors(&actorPtr[0], &actorPtr[1]);
134 return (
PhysxActor *)(actorPtr[idx]->userData);
146 nassertr(_error_type == ET_ok, NULL);
147 return (
PhysxScene *)(ptr()->getScene().userData);
159 nassertv(_error_type == ET_ok);
184 nassertv(_error_type == ET_ok);
230 nassertv(_error_type == ET_ok);
231 ptr()->setBreakable(maxForce, maxTorque);
242 nassertv(_error_type == ET_ok);
243 ptr()->setUseAccelerationSpring(value);
254 nassertr(_error_type == ET_ok,
false);
255 return ptr()->getUseAccelerationSpring();
266 nassertv(_error_type == ET_ok);
267 ptr()->setSolverExtrapolationFactor(factor);
278 nassertr(_error_type == ET_ok,
false);
279 return ptr()->getSolverExtrapolationFactor();
310 nassertv(_error_type == ET_ok);
331 nassertv(_error_type == ET_ok);
345 nassertv(_error_type == ET_ok);
346 ptr()->purgeLimitPlanes();
LPoint3f get_global_anchor() const
Retrieves the joint anchor.
bool get_use_acceleration_spring() const
Checks whether acceleration spring is used.
A point on line joint constrains a point on one body to only move along a line attached to another bo...
PhysxActor * get_actor(unsigned int idx) const
Retrieves the actor which this joint is associated with.
Cylindrical Joints permit relative translational movement between two bodies along an axis...
void set_use_acceleration_spring(bool value)
Switch between acceleration and force based spring.
A fixed joint permits no relative movement between two bodies.
static const LPoint3f & zero()
Returns a zero-length point.
A pulley joint simulates a rope between two objects passing over two pulleys.
static NxVec3 point3_to_nxVec3(const LPoint3f &p)
Converts from LPoint3f to NxVec3.
Abstract base class for the different types of joints.
static const LVector3f & zero()
Returns a zero-length vector.
A distance joint maintains a certain distance between two points on two actors.
void set_limit_point(const LPoint3f &pos, bool isOnActor2=true)
Sets the limit point.
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
A scene is a collection of bodies, constraints, and effectors which can interact. ...
void set_breakable(float maxForce, float maxTorque)
Sets the maximum force magnitude that the joint is able to withstand without breaking.
LVector3f get_global_axis() const
Retrieves the joint axis.
A D6 joint is a general constraint between two actors.
void set_global_axis(const LVector3f &axis)
Sets the direction of the joint's primary axis, specified in global coordinates.
static NxVec3 vec3_to_nxVec3(const LVector3f &v)
Converts from LVector3f to NxVec3.
static LVector3f nxVec3_to_vec3(const NxVec3 &v)
Converts from NxVec3 to LVector3f.
Actors are the main simulation objects.
void purge_limit_planes()
Deletes all limit planes added to the joint.
A prismatic joint permits relative translational movement between two bodies along an axis...
PhysxScene * get_scene() const
Retrieves the scene which this joint is associated with.
static LPoint3f nxVec3_to_point3(const NxVec3 &p)
Converts from NxVec3 to LPoint3f.
void set_name(const char *name)
Sets a name string for this object.
float get_solver_extrapolation_factor() const
Retrieves the solver extrapolation factor.
A point in plane joint constrains a point on one body to only move inside a plane attached to another...
A sphere joint constrains two points on two bodies to coincide.
TypeHandle is the identifier used to differentiate C++ class types.
void set_global_anchor(const LPoint3f &anchor)
Sets the point where the two actors are attached, specified in global coordinates.
void add_limit_plane(const LVector3f &normal, const LPoint3f &pointInPlane, float restitution=0.0f)
Adds a limit plane.
A joint which behaves in a similar way to a hinge or axel.
const char * get_name() const
Returns the name string.
void set_solver_extrapolation_factor(float factor)
Sets the solver extrapolation factor.