示例#1
0
        public void Drag(Vector2 position)
        {
            Vector3 delta = Pools.SceneCamera.ScreenToWorldPoint(position) - Pools.SceneCamera.ScreenToWorldPoint(prevScreenPosition);

            ballDelta.Set(delta.x, delta.y, delta.z);

            prevScreenPosition = position;

            Vector3 cbPosition = cueBall.transform.position;

            cbPosition += ballDelta;
            cbPosition  = MathTools.Clamp3(cbPosition, constraint.min, constraint.max);
            cueBall.transform.position = cbPosition;
            //BaseUIController.hand.Locate(cbPosition);
            if (RayCast(Pools.SceneCamera.WorldToScreenPoint(cbPosition)))
            {
                droppable = false;
                BaseUIController.hand.ChangeState(1);
            }
            else
            {
                droppable = true;
                BaseUIController.hand.ChangeState(0);
            }
        }