예제 #1
0
        /// <summary> Reconfigure this joint
        /// 
        /// </summary>
        /// <param name="b1">The first body attached to this joint
        /// </param>
        /// <param name="b2">The second body attached to this joint
        /// </param>
        /// <param name="anchor">The static anchor point between the joints
        /// </param>
        public virtual void Reconfigure(Body b1, Body b2, Vector2f anchor)
        {
            body1 = b1;
            body2 = b2;

            Matrix2f rot1 = new Matrix2f(body1.Rotation);
            Matrix2f rot2 = new Matrix2f(body2.Rotation);
            Matrix2f rot1T = rot1.Transpose();
            Matrix2f rot2T = rot2.Transpose();

            Vector2f a1 = new Vector2f(anchor);
            a1.Sub(body1.GetPosition());
            localAnchor1 = MathUtil.Mul(rot1T, a1);
            Vector2f a2 = new Vector2f(anchor);
            a2.Sub(body2.GetPosition());
            localAnchor2 = MathUtil.Mul(rot2T, a2);

            accumulatedImpulse.Reconfigure(0.0f, 0.0f);
            relaxation = 1.0f;
        }
예제 #2
0
        /// <summary> Reconfigure this joint
        /// 
        /// </summary>
        /// <param name="b1">The first body attached to this joint
        /// </param>
        /// <param name="b2">The second body attached to this joint
        /// </param>
        /// <param name="anchor1">The location of the attachment to the first body, in absolute coordinates.
        /// </param>
        /// <param name="anchor2">The location of the attachment to the second body, in absolute coordinates.
        /// </param>
        public virtual void Reconfigure(Body b1, Body b2, ROVector2f anchor1, ROVector2f anchor2)
        {
            body1 = b1;
            body2 = b2;

            Matrix2f rot1 = new Matrix2f(body1.Rotation);
            Matrix2f rot1T = rot1.Transpose();
            Vector2f a1 = new Vector2f(anchor1);
            a1.Sub(body1.GetPosition());
            localAnchor1 = MathUtil.Mul(rot1T, a1);

            Matrix2f rot2 = new Matrix2f(body2.Rotation);
            Matrix2f rot2T = rot2.Transpose();
            Vector2f a2 = new Vector2f(anchor2);
            a2.Sub(body2.GetPosition());
            localAnchor2 = MathUtil.Mul(rot2T, a2);
        }