예제 #1
0
        private void Raycast(BaseEventData eventData)
        {
            RaycastHit hit;
            Ray        ray = _cameraController.Camera.ScreenPointToRay(UnityEngine.Input.mousePosition);

            if (Physics.Raycast(ray, out hit, 100.0f))
            {
                OnObjectClick.Invoke(hit.point, hit.collider);
            }
        }
        private void inputProcess(Component_InputProcessing sender, UIControl playScreen, Component_GameMode gameMode, InputMessage message)
        {
            //mouse down
            var mouseDown = message as InputMessageMouseButtonDown;

            if (mouseDown != null && mouseDown.Button == EMouseButtons.Left)
            {
                last_selected_obj = UTools.GetObjectByCursor(SimulationApp.MainViewport, out ray, out pos);
                if (last_selected_obj != null && pos != null)
                {
                    OnObjectClick?.Invoke(last_selected_obj);
                    //ScreenMessages.Add("pos = " + pos.Value.ToString());
                    //ScreenMessages.Add("Obj = " + (last_selected_obj.TransformV.Position - pos.Value).ToString());
                }
            }
        }