Bullet Collision Detection & Physics Library
btMultiBodySphericalJointLimit.h
Go to the documentation of this file.
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2018 Erwin Coumans http://bulletphysics.org
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. This notice may not be removed or altered from any source distribution.
14*/
15
17
18#ifndef BT_MULTIBODY_SPHERICAL_JOINT_LIMIT_H
19#define BT_MULTIBODY_SPHERICAL_JOINT_LIMIT_H
20
22struct btSolverInfo;
23
25{
26protected:
33 btScalar m_rhsClamp; //maximum error
40
41public:
43 btScalar swingxRange,
44 btScalar swingyRange,
45 btScalar twistRange,
46 btScalar maxAppliedImpulse);
47
49 virtual void finalizeMultiDof();
50
51 virtual int getIslandIdA() const;
52 virtual int getIslandIdB() const;
53
54 virtual void createConstraintRows(btMultiBodyConstraintArray& constraintRows,
56 const btContactSolverInfo& infoGlobal);
57
58 virtual void setVelocityTarget(const btVector3& velTarget, btScalar kd = 1.0)
59 {
60 m_desiredVelocity = velTarget;
61 m_kd = btVector3(kd, kd, kd);
63 }
64
65 virtual void setVelocityTargetMultiDof(const btVector3& velTarget, const btVector3& kd = btVector3(1.0, 1.0, 1.0))
66 {
67 m_desiredVelocity = velTarget;
68 m_kd = kd;
70 }
71
72 virtual void setPositionTarget(const btQuaternion& posTarget, btScalar kp =1.f)
73 {
74 m_desiredPosition = posTarget;
75 m_kp = btVector3(kp, kp, kp);
77 }
78
79 virtual void setPositionTargetMultiDof(const btQuaternion& posTarget, const btVector3& kp = btVector3(1.f, 1.f, 1.f))
80 {
81 m_desiredPosition = posTarget;
82 m_kp = kp;
84 }
85
86 virtual void setErp(btScalar erp)
87 {
88 m_erp = erp;
89 }
90 virtual btScalar getErp() const
91 {
92 return m_erp;
93 }
94 virtual void setRhsClamp(btScalar rhsClamp)
95 {
96 m_rhsClamp = rhsClamp;
97 }
98
100 {
102 }
103
105 {
108 }
109
110
111 virtual void debugDraw(class btIDebugDraw* drawer);
112
113};
114
115#endif //BT_MULTIBODY_SPHERICAL_JOINT_LIMIT_H
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:314
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations.
Definition: btIDebugDraw.h:27
void setMaxAppliedImpulseMultiDof(const btVector3 &maxImp)
virtual void setRhsClamp(btScalar rhsClamp)
virtual void setPositionTarget(const btQuaternion &posTarget, btScalar kp=1.f)
virtual void debugDraw(class btIDebugDraw *drawer)
virtual void createConstraintRows(btMultiBodyConstraintArray &constraintRows, btMultiBodyJacobianData &data, const btContactSolverInfo &infoGlobal)
btMultiBodySphericalJointLimit(btMultiBody *body, int link, btScalar swingxRange, btScalar swingyRange, btScalar twistRange, btScalar maxAppliedImpulse)
This file was written by Erwin Coumans.
virtual void setVelocityTargetMultiDof(const btVector3 &velTarget, const btVector3 &kd=btVector3(1.0, 1.0, 1.0))
virtual void setPositionTargetMultiDof(const btQuaternion &posTarget, const btVector3 &kp=btVector3(1.f, 1.f, 1.f))
virtual void setVelocityTarget(const btVector3 &velTarget, btScalar kd=1.0)
The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatr...
Definition: btQuaternion.h:50
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:82