Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/kicklib2/src/external/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.h @ 8382

Last change on this file since 8382 was 8284, checked in by rgrieder, 14 years ago

Merged revisions 7978 - 8096 from kicklib to kicklib2.

  • Property svn:eol-style set to native
File size: 2.6 KB
Line 
1/*
2Bullet Continuous Collision Detection and Physics Library, http://bulletphysics.org
3Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
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
16#ifndef GENERIC_6DOF_SPRING_CONSTRAINT_H
17#define GENERIC_6DOF_SPRING_CONSTRAINT_H
18
19
20#include "LinearMath/btVector3.h"
21#include "btTypedConstraint.h"
22#include "btGeneric6DofConstraint.h"
23
24
25/// Generic 6 DOF constraint that allows to set spring motors to any translational and rotational DOF
26
27/// DOF index used in enableSpring() and setStiffness() means:
28/// 0 : translation X
29/// 1 : translation Y
30/// 2 : translation Z
31/// 3 : rotation X (3rd Euler rotational around new position of X axis, range [-PI+epsilon, PI-epsilon] )
32/// 4 : rotation Y (2nd Euler rotational around new position of Y axis, range [-PI/2+epsilon, PI/2-epsilon] )
33/// 5 : rotation Z (1st Euler rotational around Z axis, range [-PI+epsilon, PI-epsilon] )
34
35class btGeneric6DofSpringConstraint : public btGeneric6DofConstraint
36{
37protected:
38        bool            m_springEnabled[6];
39        btScalar        m_equilibriumPoint[6];
40        btScalar        m_springStiffness[6];
41        btScalar        m_springDamping[6]; // between 0 and 1 (1 == no damping)
42        void internalUpdateSprings(btConstraintInfo2* info);
43public: 
44    btGeneric6DofSpringConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA);
45        void enableSpring(int index, bool onOff);
46        void setStiffness(int index, btScalar stiffness);
47        void setDamping(int index, btScalar damping);
48        void setEquilibriumPoint(); // set the current constraint position/orientation as an equilibrium point for all DOF
49        void setEquilibriumPoint(int index);  // set the current constraint position/orientation as an equilibrium point for given DOF
50        void setEquilibriumPoint(int index, btScalar val);
51        virtual void getInfo2 (btConstraintInfo2* info);
52};
53
54#endif // GENERIC_6DOF_SPRING_CONSTRAINT_H
55
Note: See TracBrowser for help on using the repository browser.