public Generic6DofConstraint(RigidBody rbA, RigidBody rbB,  ref Matrix frameInA,  ref Matrix frameInB ,bool useLinearReferenceFrameA) : base(TypedConstraintType.D6_CONSTRAINT_TYPE,rbA,rbB)
 {
     m_frameInA = frameInA;
     m_frameInB = frameInB;
     m_useLinearReferenceFrameA = useLinearReferenceFrameA;
     m_useOffsetForConstraintFrame = D6_USE_FRAME_OFFSET;
     m_flags = 0;
     m_linearLimits = new TranslationalLimitMotor();
     m_angularLimits[0] = new RotationalLimitMotor();
     m_angularLimits[1] = new RotationalLimitMotor();
     m_angularLimits[2] = new RotationalLimitMotor();
     CalculateTransforms();
 }
        protected Generic6DofConstraint(RigidBody rbB, ref Matrix frameInB, bool useLinearReferenceFrameB) : base(TypedConstraintType.D6_CONSTRAINT_TYPE,GetFixedBody(),rbB)
        {
            m_frameInB = frameInB;
            m_useLinearReferenceFrameA = useLinearReferenceFrameB;
            m_useOffsetForConstraintFrame = D6_USE_FRAME_OFFSET;
            m_flags = 0;
            m_linearLimits = new TranslationalLimitMotor();
            m_angularLimits[0] = new RotationalLimitMotor();
            m_angularLimits[1] = new RotationalLimitMotor();
            m_angularLimits[2] = new RotationalLimitMotor();

            ///not providing rigidbody A means implicitly using worldspace for body A
	        m_frameInA = MathUtil.BulletMatrixMultiply(rbB.GetCenterOfMassTransform(),m_frameInB);

            CalculateTransforms();
        }
		public TranslationalLimitMotor(TranslationalLimitMotor other )
		{
			m_lowerLimit = other.m_lowerLimit;
			m_upperLimit = other.m_upperLimit;
			m_accumulatedImpulse = other.m_accumulatedImpulse;

			m_limitSoftness = other.m_limitSoftness ;
			m_damping = other.m_damping;
			m_restitution = other.m_restitution;
			m_normalCFM = other.m_normalCFM;
			m_stopERP = other.m_stopERP;
			m_stopCFM = other.m_stopCFM;

			for(int i=0; i < 3; i++) 
			{
				m_enableMotor[i] = other.m_enableMotor[i];
			}
			m_targetVelocity = other.m_targetVelocity;
			m_maxMotorForce = other.m_maxMotorForce;

		}