コード例 #1
0
        public override void Update(float dt)
        {
            base.Update(dt);
            if (CCMouse.Instance.HasPosition)
            {
                // Set the first anchor point (the one attached to the static body) of the dolly servo to the mouse's x position.
                dollyServo.SetAnchorA(new cpVect(CCMouse.Instance.Position.x, 100));
                // Set the max length of the winch servo to match the mouse's height.
                winchServo.SetMax(cp.cpfmax(100 - CCMouse.Instance.Position.y, 50));

                if (hookJoint != null && CCMouse.Instance.rightclick)
                {
                    space.RemoveConstraint(hookJoint);
                    //cpConstraintFree(hookJoint);
                    hookJoint = null;
                }
            }
            space.Step(dt);
        }