Ejemplo n.º 1
0
        /// Get the current joint translation, usually in meters.
        public float GetJointTranslation()
        {
            Body b1 = _bodyA;
            Body b2 = _bodyB;

            Vector2 p1   = b1.GetWorldPoint(_localAnchor1);
            Vector2 p2   = b2.GetWorldPoint(_localAnchor2);
            Vector2 d    = p2 - p1;
            Vector2 axis = b1.GetWorldVector(_localxAxis1);

            float translation = Vector2.Dot(d, axis);

            return(translation);
        }
Ejemplo n.º 2
0
        /// Get the current joint translation, usually in meters.
        public float GetJointTranslation()
        {
            Body bA = m_bodyA;
            Body bB = m_bodyB;

            Vec2 pA   = bA.GetWorldPoint(m_localAnchorA);
            Vec2 pB   = bB.GetWorldPoint(m_localAnchorB);
            Vec2 d    = pB - pA;
            Vec2 axis = bA.GetWorldVector(m_localXAxisA);

            float translation = Utilities.Dot(d, axis);

            return(translation);
        }