コード例 #1
0
    private void RightTriggerPressed(object sender, VRTK.ControllerInteractionEventArgs e)
    {
        switch (status)
        {
        case STATUS.SELECT:
            if (sceneManager.activeEntity.obj != null)
            {
                SelectObject(sceneManager.activeEntity.obj);
                status = STATUS.CUT;
                quad.SetActive(true);
            }
            break;

        case STATUS.CUT:
            List <MObject> objects = curObj.PlaneSplit(quad.transform.TransformDirection(Vector3.forward).normalized, quad.transform.TransformPoint(Vector3.zero));
            if (objects.Count > 1)
            {
                sceneManager.objects.Remove(curObj);
                foreach (MObject obj in objects)
                {
                    sceneManager.objects.Add(obj);
                }
                curObj.Destroy();
                curObj = null;
                sceneManager.sceneStateMachine.SwitchState((uint)SceneManager.SceneStatus.TRANSFORM, null);
            }
            else
            {
                foreach (MObject obj in objects)
                {
                    obj.Destroy();
                }
            }
            break;
        }
    }