Differential D1739 Diff 5899 extern/bullet2/src/BulletDynamics/ConstraintSolver/btHinge2Constraint.cpp
Changeset View
Changeset View
Standalone View
Standalone View
extern/bullet2/src/BulletDynamics/ConstraintSolver/btHinge2Constraint.cpp
| Show All 19 Lines | |||||
| #include "LinearMath/btTransformUtil.h" | #include "LinearMath/btTransformUtil.h" | ||||
| // constructor | // constructor | ||||
| // anchor, axis1 and axis2 are in world coordinate system | // anchor, axis1 and axis2 are in world coordinate system | ||||
| // axis1 must be orthogonal to axis2 | // axis1 must be orthogonal to axis2 | ||||
| btHinge2Constraint::btHinge2Constraint(btRigidBody& rbA, btRigidBody& rbB, btVector3& anchor, btVector3& axis1, btVector3& axis2) | btHinge2Constraint::btHinge2Constraint(btRigidBody& rbA, btRigidBody& rbB, btVector3& anchor, btVector3& axis1, btVector3& axis2) | ||||
| : btGeneric6DofSpringConstraint(rbA, rbB, btTransform::getIdentity(), btTransform::getIdentity(), true), | : btGeneric6DofSpring2Constraint(rbA, rbB, btTransform::getIdentity(), btTransform::getIdentity(),RO_XYZ), | ||||
| m_anchor(anchor), | m_anchor(anchor), | ||||
| m_axis1(axis1), | m_axis1(axis1), | ||||
| m_axis2(axis2) | m_axis2(axis2) | ||||
| { | { | ||||
| // build frame basis | // build frame basis | ||||
| // 6DOF constraint uses Euler angles and to define limits | // 6DOF constraint uses Euler angles and to define limits | ||||
| // it is assumed that rotational order is : | // it is assumed that rotational order is : | ||||
| // Z - first, allowed limits are (-PI,PI); | // Z - first, allowed limits are (-PI,PI); | ||||
| Show All 17 Lines | m_axis2(axis2) | ||||
| // sei limits | // sei limits | ||||
| setLinearLowerLimit(btVector3(0.f, 0.f, -1.f)); | setLinearLowerLimit(btVector3(0.f, 0.f, -1.f)); | ||||
| setLinearUpperLimit(btVector3(0.f, 0.f, 1.f)); | setLinearUpperLimit(btVector3(0.f, 0.f, 1.f)); | ||||
| // like front wheels of a car | // like front wheels of a car | ||||
| setAngularLowerLimit(btVector3(1.f, 0.f, -SIMD_HALF_PI * 0.5f)); | setAngularLowerLimit(btVector3(1.f, 0.f, -SIMD_HALF_PI * 0.5f)); | ||||
| setAngularUpperLimit(btVector3(-1.f, 0.f, SIMD_HALF_PI * 0.5f)); | setAngularUpperLimit(btVector3(-1.f, 0.f, SIMD_HALF_PI * 0.5f)); | ||||
| // enable suspension | // enable suspension | ||||
| enableSpring(2, true); | enableSpring(2, true); | ||||
| setStiffness(2, SIMD_PI * SIMD_PI * 4.f); // period 1 sec for 1 kilogramm weel :-) | setStiffness(2, SIMD_PI * SIMD_PI * 4.f); | ||||
| setDamping(2, 0.01f); | setDamping(2, 0.01f); | ||||
| setEquilibriumPoint(); | setEquilibriumPoint(); | ||||
| } | } | ||||