Пример #1
0
    // Update is called once per frame
    void Update()
    {
        if (mouseQuery.ClickedBody != null)
        {
            // Attach with mouse joint
            if (mouseJoint == null)
            {
                mouseJoint              = gameObject.AddComponent <LPJointMouse>();
                mouseJoint.BodyA        = mouseQuery.ClickedBody.gameObject;
                mouseJoint.BodyB        = mouseQuery.ClickedBody.gameObject;
                mouseJoint.MaximumForce = 500;
                mouseJoint.Initialise(lpMan);
            }

            bool    aTouch   = false;
            Vector3 touchPos = new Vector3();
            InputUtilities.GetMouseInput(out aTouch, out touchPos);
            if (aTouch)
            {
                Vector3 mousePos = Camera.main.ScreenToWorldPoint(touchPos);
                mouseJoint.SetTarget(mousePos);
            }
        }
        else
        {
            TryDeleteMouseJoint();
        }
    }
Пример #2
0
 // Update is called once per frame
 void Update()
 {
     mousejoint.SetTarget(transform.position);
 }
Пример #3
0
 public void MoveIt(Vector3 pos)
 {
     mj.SetTarget(pos);
 }
Пример #4
0
 public void MoveIt(Vector3 pos)
 {
     mj.SetTarget(Camera.main.ScreenToWorldPoint(pos));
 }