예제 #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);
        }