PxD6JointCreate_GenericCone

Defined in include/extensions/PxD6JointCreate.h

PxJoint *PxD6JointCreate_GenericCone(float &apiroty, float &apirotz, PxPhysics &physics, PxRigidActor *actor0, const PxVec3 &localPos0, PxRigidActor *actor1, const PxVec3 &localPos1, float minLimit1, float maxLimit1, float minLimit2, float maxLimit2, bool useD6)

Helper function to create a spherical joint, using either a PxD6Joint or PxSphericalJoint.

This function supports a cone limit shape, defined by two pairs of angular limit values. This can be used to create an asymmetric cone. If the angular limit values are symmetric (i.e. minLimit1=-maxLimit1 and minLimit2=-maxLimit2) then the cone axis is the X axis in actor0’s space. If the limits are not symmetric, the function rotates the cone axis accordingly so that limits remain symmetric for PhysX. If this happens, the initial joint frames will be different for both actors. By default minLimit1/maxLimit1 are limits around the joint’s Y axis, and minLimit2/maxLimit2 are limits around the joint’s Z axis.

The function creates hard limits, and uses PhysX’s default contact distance parameter.

Limits are expressed in radians. Allowed range is ]-PI;PI[.

The cone axis is equivalent to the twist axis for the D6 joint. The twist motion is not limited.

The returned apiroty and apirotz values can later be added to retrieved Y and Z swing angle values (from the joint), to remap angle values to the given input range.

See also

PxD6Joint PxSphericalJoint

Parameters
  • apiroty[out] Amount of rotation around Y used to setup actor0’s joint frame

  • apirotz[out] Amount of rotation around Z used to setup actor0’s joint frame

  • physics[in] The physics SDK

  • actor0[in] An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame

  • localPos0[in] The position of the joint relative to actor0

  • actor1[in] An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame

  • localPos1[in] The position of the joint relative to actor1

  • minLimit1[in] Min angular limit along the joint frame’s second axis (first axis = cone axis)

  • maxLimit1[in] Max angular limit along the joint frame’s second axis (first axis = cone axis)

  • minLimit2[in] Min angular limit along the joint frame’s third axis (first axis = cone axis)

  • maxLimit2[in] Max angular limit along the joint frame’s third axis (first axis = cone axis)

  • useD6[in] True to use a PxD6Joint, false to use a PxSphericalJoint;

Returns

The created joint.