pass in const vectors into btUniversalConstraint and normalize the local copy
Thanks to SkewMatrix for the patch, http://code.google.com/p/bullet/issues/detail?id=571
This commit is contained in:
@@ -27,7 +27,7 @@ subject to the following restrictions:
|
|||||||
// 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
|
||||||
btUniversalConstraint::btUniversalConstraint(btRigidBody& rbA, btRigidBody& rbB, btVector3& anchor, btVector3& axis1, btVector3& axis2)
|
btUniversalConstraint::btUniversalConstraint(btRigidBody& rbA, btRigidBody& rbB, const btVector3& anchor, const btVector3& axis1, const btVector3& axis2)
|
||||||
: btGeneric6DofConstraint(rbA, rbB, btTransform::getIdentity(), btTransform::getIdentity(), true),
|
: btGeneric6DofConstraint(rbA, rbB, btTransform::getIdentity(), btTransform::getIdentity(), true),
|
||||||
m_anchor(anchor),
|
m_anchor(anchor),
|
||||||
m_axis1(axis1),
|
m_axis1(axis1),
|
||||||
@@ -42,8 +42,8 @@ btUniversalConstraint::btUniversalConstraint(btRigidBody& rbA, btRigidBody& rbB,
|
|||||||
// new position of X, allowed limits are (-PI,PI);
|
// new position of X, allowed limits are (-PI,PI);
|
||||||
// So to simulate ODE Universal joint we should use parent axis as Z, child axis as Y and limit all other DOFs
|
// So to simulate ODE Universal joint we should use parent axis as Z, child axis as Y and limit all other DOFs
|
||||||
// Build the frame in world coordinate system first
|
// Build the frame in world coordinate system first
|
||||||
btVector3 zAxis = axis1.normalize();
|
btVector3 zAxis = m_axis1.normalize();
|
||||||
btVector3 yAxis = axis2.normalize();
|
btVector3 yAxis = m_axis2.normalize();
|
||||||
btVector3 xAxis = yAxis.cross(zAxis); // we want right coordinate system
|
btVector3 xAxis = yAxis.cross(zAxis); // we want right coordinate system
|
||||||
btTransform frameInW;
|
btTransform frameInW;
|
||||||
frameInW.setIdentity();
|
frameInW.setIdentity();
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public:
|
|||||||
// 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
|
||||||
btUniversalConstraint(btRigidBody& rbA, btRigidBody& rbB, btVector3& anchor, btVector3& axis1, btVector3& axis2);
|
btUniversalConstraint(btRigidBody& rbA, btRigidBody& rbB, const btVector3& anchor, const btVector3& axis1, const btVector3& axis2);
|
||||||
// access
|
// access
|
||||||
const btVector3& getAnchor() { return m_calculatedTransformA.getOrigin(); }
|
const btVector3& getAnchor() { return m_calculatedTransformA.getOrigin(); }
|
||||||
const btVector3& getAnchor2() { return m_calculatedTransformB.getOrigin(); }
|
const btVector3& getAnchor2() { return m_calculatedTransformB.getOrigin(); }
|
||||||
|
|||||||
Reference in New Issue
Block a user