1/*
2 * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved.
3 *
4 * NVIDIA CORPORATION and its licensors retain all intellectual property
5 * and proprietary rights in and to this software, related documentation
6 * and any modifications thereto. Any use, reproduction, disclosure or
7 * distribution of this software and related documentation without an express
8 * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 */
10// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
11// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
12
13
14#ifndef PX_FIXEDJOINT_H
15#define PX_FIXEDJOINT_H
16/** \addtogroup extensions
17 @{
18*/
19
20#include "extensions/PxJoint.h"
21
22#ifndef PX_DOXYGEN
23namespace physx
24{
25#endif
26
27class PxFixedJoint;
28
29/**
30\brief Create a fixed joint.
31
32 \param[in] physics the physics SDK
33 \param[in] actor0 an actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame
34 \param[in] localFrame0 the position and orientation of the joint relative to actor0
35 \param[in] actor1 an actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame
36 \param[in] localFrame1 the position and orientation of the joint relative to actor1
37
38@see PxFixedJoint
39*/
40
41PxFixedJoint* PxFixedJointCreate(PxPhysics& physics,
42 PxRigidActor* actor0, const PxTransform& localFrame0,
43 PxRigidActor* actor1, const PxTransform& localFrame1);
44
45
46/**
47 \brief A fixed joint permits no relative movement between two bodies. ie the bodies are glued together.
48
49 \image html fixedJoint.png
50
51 @see PxFixedJointCreate() PxJoint
52*/
53
54class PxFixedJoint : public PxJoint
55{
56public:
57
58 /**
59 \brief Set the linear tolerance threshold for projection. Projection is enabled if PxConstraintFlag::ePROJECTION
60 is set for the joint.
61
62 If the joint separates by more than this distance along its locked degrees of freedom, the solver
63 will move the bodies to close the distance.
64
65 Setting a very small tolerance may result in simulation jitter or other artifacts.
66
67 Sometimes it is not possible to project (for example when the joints form a cycle).
68
69 <b>Range:</b> [0, PX_MAX_F32)<br>
70 <b>Default:</b> 1e10f
71
72 \param[in] tolerance the linear tolerance threshold
73
74 @see getProjectionLinearTolerance() PxJoint::setConstraintFlags() PxConstraintFlag::ePROJECTION
75 */
76
77 virtual void setProjectionLinearTolerance(PxReal tolerance) = 0;
78
79 /**
80 \brief Get the linear tolerance threshold for projection.
81
82 \return the linear tolerance threshold
83
84 @see setProjectionLinearTolerance() PxJoint::setConstraintFlag()
85 */
86
87 virtual PxReal getProjectionLinearTolerance() const = 0;
88
89 /**
90 \brief Set the angular tolerance threshold for projection. Projection is enabled if
91 PxConstraintFlag::ePROJECTION is set for the joint.
92
93 If the joint deviates by more than this angle around its locked angular degrees of freedom,
94 the solver will move the bodies to close the angle.
95
96 Setting a very small tolerance may result in simulation jitter or other artifacts.
97
98 Sometimes it is not possible to project (for example when the joints form a cycle).
99
100 <b>Range:</b> [0,Pi] <br>
101 <b>Default:</b> Pi
102
103 \param[in] tolerance the angular tolerance threshold in radians
104
105 @see getProjectionAngularTolerance() PxJoint::setConstraintFlag() PxConstraintFlag::ePROJECTION
106 */
107
108 virtual void setProjectionAngularTolerance(PxReal tolerance) = 0;
109
110 /**
111 \brief Get the angular tolerance threshold for projection.
112
113 \return the angular tolerance threshold in radians
114
115 @see setProjectionAngularTolerance()
116 */
117
118 virtual PxReal getProjectionAngularTolerance() const = 0;
119
120 /**
121 \brief Returns string name of PxFixedJoint, used for serialization
122 */
123 virtual const char* getConcreteTypeName() const { return "PxFixedJoint"; }
124
125protected:
126
127 //serialization
128
129 /**
130 \brief Constructor
131 */
132 PX_INLINE PxFixedJoint(PxType concreteType, PxBaseFlags baseFlags) : PxJoint(concreteType, baseFlags) {}
133
134 /**
135 \brief Deserialization constructor
136 */
137 PX_INLINE PxFixedJoint(PxBaseFlags baseFlags) : PxJoint(baseFlags) {}
138
139 /**
140 \brief Returns whether a given type name matches with the type of this instance
141 */
142 virtual bool isKindOf(const char* name) const { return !strcmp("PxFixedJoint", name) || PxJoint::isKindOf(name); }
143
144 //~serialization
145};
146
147#ifndef PX_DOXYGEN
148} // namespace physx
149#endif
150
151/** @} */
152#endif
153