예제 #1
0
        /// <summary>
        ///     Gets the reaction torque using the specified inv dt
        /// </summary>
        /// <param name="invDt">The inv dt</param>
        /// <returns>The float</returns>
        public override float GetReactionTorque(float invDt)
        {
            // TODO_ERIN not tested
            Vec2  r = Math.Mul(Body2.GetXForm().R, LocalAnchor2 - Body2.GetLocalCenter());
            Vec2  p = Impulse * jacobian.Linear2;
            float l = Impulse * jacobian.Angular2 - Vec2.Cross(r, p);

            return(invDt * l);
        }
예제 #2
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="MouseJoint" /> class
        /// </summary>
        /// <param name="def">The def</param>
        public MouseJoint(MouseJointDef def)
            : base(def)
        {
            Target      = def.Target;
            LocalAnchor = Math.MulT(Body2.GetXForm(), Target);

            MaxForce = def.MaxForce;
            Impulse.SetZero();

            FrequencyHz  = def.FrequencyHz;
            DampingRatio = def.DampingRatio;

            Beta  = 0.0f;
            Gamma = 0.0f;
        }