예제 #1
0
        void Start()
        {
            DontDestroyOnLoad(gameObject);

            #if !UNITY_EDITOR
            Main.OnAsyncEvent += MainOnAsyncEvent;

            InitToolkit init = new InitToolkit();
            init.contentRestrictions.DefaultAgeRestriction   = ContentRestriction.NP_NO_AGE_RESTRICTION;
            init.contentRestrictions.ApplyContentRestriction = false;
            init.SetPushNotificationsFlags(PushNotificationsFlags.None);
            init.threadSettings.affinity  = Affinity.AllCores;
            init.memoryPools.JsonPoolSize = 6 * 1024 * 1024;
            init.memoryPools.SslPoolSize *= 4;

            initResult = Main.Initialize(init);
            if (!initResult.Initialized)
            {
                return;
            }

            loggedInUser = PS4Input.RefreshUsersDetails(Utility.primaryUserId);
            PS4PlayerPrefs.SetTitleStrings("Gunhouse", "Load your guns! Rain death from above!", "Save Data");
            StartTrophy();
            #endif
        }
예제 #2
0
    public override void SelectByInput()
    {
        if (!ManagerPause.Pause)
        {
            touching = true;
            if (!isWaitPress && canTouch)
            {
                canTouch = false;
                if (isPressing)
                {
                    callbackClose();
                }
                else
                {
                    callbackOpen();
                }
                Mira.SetTrigger("Start");
                MiraSpriteRenderer.enabled = true;
#if UNITY_PS4 && !(UNITY_EDITOR)
                audio1.PlayOnDualShock4(PS4Input.PadGetUsersDetails(0).userId);
#endif
                audio1.Play();
                isWaitPress = true;
                StartCoroutine(Pressing(timeToUnlock));
                isPressing = !isPressing;
            }
        }
    }
예제 #3
0
파일: GamePad.cs 프로젝트: simul/unity
        void Update()
        {
            if (Application.isConsolePlatform)
            {
#if UNITY_PS4
                if (PS4Input.PadIsConnected(playerId))
                {
                    // Set the gamepad to the start values for the player
                    if (!hasSetupGamepad)
                    {
                        ToggleGamePad(true);
                    }

                    // Handle each part individually
                    Thumbsticks();

                    // Options button is on its own, so we'll do it here
                    if (Input.GetKey((KeyCode)Enum.Parse(typeof(KeyCode), "Joystick" + stickID + "Button7", true)))
                    {
                        // Reset the gyro orientation to default
                        PS4Input.PadResetOrientation(playerId);
                    }
                }
#endif
            }
            else if (hasSetupGamepad)
            {
                ToggleGamePad(false);
            }
        }
예제 #4
0
        /// <summary>
        /// Coroutine called when calling Trigger Haptic pulse for the ps4
        /// </summary>
        /// <param name="durationMicroSec"></param>
        /// <param name="intensity"></param>
        /// <returns></returns>
        private IEnumerator Vibrate(float durationMicroSec, int intensity = 64)
        {
            //Changes the intensity value depending on the value passed
            //Instead of yielding between times, have a constant stream of vibration
            //Coroutine stops in TriggerHaptic pulse if it's not called
            //Working as intended, but not sure if it's the best way to approach it, different than the vive
            if (durationMicroSec <= 200)
            {
                intensity = 64;
            }
            else if (durationMicroSec <= 400)
            {
                intensity = 128;
            }
            else if (durationMicroSec <= 600)
            {
                intensity = 150;
            }
            else if (durationMicroSec > 600)
            {
                intensity = 255;
            }
            PS4Input.MoveSetVibration(0, whichController, intensity);
            // Debug.Log("Calling vibrate from PS4 move before yield");
            yield return(null);

            PS4Input.MoveSetVibration(0, whichController, 0); //Not sure if this is called
            // yield return new WaitForSeconds(durationInSeconds);
            // PS4Input.MoveSetVibration(0, whichController, 0);
            // Debug.Log("Calling vibrate from PS4 after yield");
        }
예제 #5
0
    void Lightbar()
    {
        // Make the lightbar change colour when we hold down buttons
        if (Input.GetKey((KeyCode)Enum.Parse(typeof(KeyCode), "Joystick" + stickID + "Button0", true)))
        {
            lightbarColour = Color.Lerp(lightbarColour, Color.blue, Time.deltaTime * 4f);
        }

        if (Input.GetKey((KeyCode)Enum.Parse(typeof(KeyCode), "Joystick" + stickID + "Button1", true)))
        {
            lightbarColour = Color.Lerp(lightbarColour, Color.red, Time.deltaTime * 4f);
        }

        if (Input.GetKey((KeyCode)Enum.Parse(typeof(KeyCode), "Joystick" + stickID + "Button2", true)))
        {
            lightbarColour = Color.Lerp(lightbarColour, Color.magenta, Time.deltaTime * 4f);
        }

        if (Input.GetKey((KeyCode)Enum.Parse(typeof(KeyCode), "Joystick" + stickID + "Button3", true)))
        {
            lightbarColour = Color.Lerp(lightbarColour, Color.green, Time.deltaTime * 4f);
        }

        // Set the lightbar sprite and the physical lightbar change to the current colour
        gamePad.lightbar.color = lightbarColour;
        gamePad.light.color    = lightbarColour;
        PS4Input.PadSetLightBar(playerId,
                                Mathf.RoundToInt(lightbarColour.r * 255),
                                Mathf.RoundToInt(lightbarColour.g * 255),
                                Mathf.RoundToInt(lightbarColour.b * 255));
    }
예제 #6
0
        private IEnumerator RegisterHand(bool isPrimaryHand)
        {
            // right is zero left is one
            // primary hand is right
            yield return(new WaitUntil(() => PS4Input.MoveIsConnected(0, isPrimaryHand?0:1)));

            var primaryhandles   = new int[1];
            var secondaryhandles = new int[1];

            PS4Input.MoveGetUsersMoveHandles(1, primaryhandles, secondaryhandles);

            handle = isPrimaryHand ? primaryhandles[0] : secondaryhandles[0];

            var result = Tracker.RegisterTrackedDevice(PlayStationVRTrackedDevice.DeviceMove, handle, trackingType, trackerUsageType);

            if (result == PlayStationVRResult.Ok)
            {
                //TODO: May have to have a separate tracking status for every hand separately?
                //Look at psvr Unity example
                // var trackingStatus = new PlayStationVRTrackingStatus();
                while (trackingStatus == PlayStationVRTrackingStatus.NotStarted)
                {
                    Tracker.GetTrackedDeviceStatus(handle, out trackingStatus);
                    yield return(null);
                }

                Tracker.GetTrackedDeviceLedColor(handle, out trackedColor);
            }
            else
            {
                Debug.LogError("Tracking failed for DeviceMove! This may be because you're trying to register too many devices at once.");
            }
        }
예제 #7
0
    public void SetLightColor(Color color)
    {
#if UNITY_PS4 && !(UNITY_EDITOR)
        PS4Input.PadSetLightBar(0,
                                Mathf.RoundToInt(color.r * 255),
                                Mathf.RoundToInt(color.g * 255),
                                Mathf.RoundToInt(color.b * 255));
#endif
    }
예제 #8
0
 void AudioShake()
 {
     if (audio != null && audio.enabled)
     {
                     #if UNITY_PS4 && !(UNITY_EDITOR)
         audio.PlayOnDualShock4(PS4Input.PadGetUsersDetails(0).userId);
                     #else
         audio.Play();
                     #endif
     }
 }
예제 #9
0
    void StopVibration()
    {
#if UNITY_XBOXONE && !UNITY_EDITOR
        GamepadPlugin.SetGamepadVibration(XboxOneInput.GetControllerId(0), 0f, 0f, 0, 0);
#endif

#if UNITY_PS4 && !UNITY_EDITOR
        int val = 0;
        if (int.TryParse(LoginHandler.instance.UserID, out val))
        {
            PS4Input.PadSetVibration(val, 0, 0);
        }
#endif
    }
예제 #10
0
    void DoVibration()
    {
#if UNITY_XBOXONE && !UNITY_EDITOR
        GamepadPlugin.SetGamepadVibration(XboxOneInput.GetControllerId(0), .5f, .5f, 0, 0);
#endif

#if UNITY_PS4 && !UNITY_EDITOR
        int val = 0;
        if (int.TryParse(LoginHandler.instance.UserID, out val))
        {
            PS4Input.PadSetVibration(val, (int)Mathf.Clamp(127 * scale, 0, 255), (int)Mathf.Clamp(127 * scale, 0, 255));
        }
#endif
    }
예제 #11
0
    public void Stop()
    {
        if (InputEnum.GamePad.ToString() == "xbox 360")
        {
            //Handheld.Vibrate();
            GamePad.SetVibration(0, 0f, 0f);
            Debug.Log("StopRumble");
        }

        StopCoroutine("Vibrate");
        #if UNITY_PS4 && !(UNITY_EDITOR)
        PS4Input.PadSetVibration(0, 0, 0);
        #endif
    }
예제 #12
0
    // Use this for initialization
    void Start()
    {
        DontDestroyOnLoad(transform.gameObject);
        AudioSource audio = GetComponent <AudioSource>();

        if (!audio.isPlaying)
        {
#if UNITY_PS4 && !(UNITY_EDITOR)
            audio.PlayOnDualShock4(PS4Input.PadGetUsersDetails(0).userId);
#else
            audio.Play();
#endif
        }
        Destroy(gameObject, audio.clip.length);
    }
예제 #13
0
    void Update()
    {
        if (PS4Input.PadIsConnected(playerId))
        {
            // Set the gamepad to the start values for the player
            if (!hasSetupGamepad)
            {
                ToggleGamePad(true);
            }

            // Handle each part individually
            Touchpad();
            Thumbsticks();
            InputButtons();
            DPadButtons();
            TriggerShoulderButtons();
            Lightbar();
            Speaker();

            // Options button is on its own, so we'll do it here
            if (Input.GetKey((KeyCode)Enum.Parse(typeof(KeyCode), "Joystick" + stickID + "Button7", true)))
            {
                gamePad.options.color = inputOn;

                // Reset the gyro orientation and lightbar to default
                PS4Input.PadResetOrientation(playerId);
                PS4Input.PadResetLightBar(playerId);
                lightbarColour = GetPlayerColor(PS4Input.GetUsersDetails(playerId).color);
            }
            else
            {
                gamePad.options.color = inputOff;
            }

            // Make the gyro rotate to match the physical controller
            gamePad.gyro.localEulerAngles = new Vector3(-PS4Input.PadGetLastOrientation(playerId).x,
                                                        -PS4Input.PadGetLastOrientation(playerId).y,
                                                        PS4Input.PadGetLastOrientation(playerId).z) * 100;

            // rebuild the username everyframe, in case it's changed due to PSN access
            gamePad.text.text = PS4Input.RefreshUsersDetails(playerId).userName + "\n(" + connectionType + ")";
        }
        else if (hasSetupGamepad)
        {
            ToggleGamePad(false);
        }
    }
예제 #14
0
    public void Vibrate()
    {
        if (SaveManager.Instance.dataKlaus.Rumble && InputEnum.GamePad.ToString() == "xbox 360")
        {
            GamePad.SetVibration(0, 0.6f, 0.6f);
        }


        if (SaveManager.Instance.dataKlaus != null && !SaveManager.Instance.dataKlaus.Rumble)
        {
            return;
        }

        StopCoroutine("Vibrate");
        #if UNITY_PS4 && !(UNITY_EDITOR)
        PS4Input.PadSetVibration(0, IntensityMayor, IntensityMinor);
        #endif
    }
예제 #15
0
파일: GamePad.cs 프로젝트: simul/unity
        // Toggle the gamepad between connected and disconnected states
        void ToggleGamePad(bool active)
        {
            if (active)
            {
#if UNITY_PS4
                // Set 3D Text to whoever's using the pad
                loggedInUser = PS4Input.RefreshUsersDetails(playerId);
#endif
                hasSetupGamepad = true;
            }
            else
            {
                // Hide the touches
                touches[0].gameObject.SetActive(false);
                touches[1].gameObject.SetActive(false);

                hasSetupGamepad = false;
            }
        }
예제 #16
0
    void suena()
    {
        AudioSource audio = GetComponent <AudioSource>();

        if (audio != null && audio.enabled)
        {
#if UNITY_PS4 && !(UNITY_EDITOR)
            if (reproduceInControl)
            {
                audio.PlayOnDualShock4(PS4Input.PadGetUsersDetails(0).userId);
                audio.Play();
            }
            else
            {
                audio.Play();
            }
#else
            audio.Play();
#endif
        }
    }
예제 #17
0
파일: VRInput.cs 프로젝트: Jurosale/LiftVR
    public static bool getRightTriggerRelease()
    {
#if UNITY_PS4
        if (PS4Input.MoveGetAnalogButton(0, 0) > 0 && priorRight == true)
        {
            return(true);
        }
        else
        {
            return(false);
        }
#else
        if (rightController.GetPress(triggerButton) && priorRight == true)
        {
            return(true);
        }
        else
        {
            return(false);
        }
#endif
    }
예제 #18
0
    // Toggle the gamepad between connected and disconnected states
    void ToggleGamePad(bool active)
    {
        if (active)
        {
            // Set the lightbar colour to the start/default value
            lightbarColour = GetPlayerColor(PS4Input.GetUsersDetails(playerId).color);

            // Set 3D Text to whoever's using the pad
            loggedInUser      = PS4Input.RefreshUsersDetails(playerId);
            gamePad.text.text = loggedInUser.userName + "\n(" + connectionType + ")";

            // Reset and show the gyro
            gamePad.gyro.localRotation = Quaternion.identity;
            gamePad.gyro.gameObject.SetActive(true);

            hasSetupGamepad = true;
        }
        else
        {
            // Hide the touches
            touches[0].gameObject.SetActive(false);
            touches[1].gameObject.SetActive(false);

            // Set the lightbar to a default colour
            lightbarColour         = Color.gray;
            gamePad.lightbar.color = lightbarColour;
            gamePad.light.color    = Color.black;

            // Set the 3D Text to show the pad is disconnected
            gamePad.text.text = "Disconnected";

            // Hide the gyro
            gamePad.gyro.gameObject.SetActive(false);

            hasSetupGamepad = false;
        }
    }
예제 #19
0
파일: VRInput.cs 프로젝트: Jurosale/LiftVR
    public static bool getLeftTrigger()
    {
#if UNITY_PS4
        if (PS4Input.MoveGetAnalogButton(0, 1) > 0)
        {
            return(true);
        }
        else
        {
            return(false);
        }
#else
        if (leftController.GetPress(triggerButton))
        {
            //Debug.Log("trig press L2");

            return(true);
        }
        else
        {
            return(false);
        }
#endif
    }
예제 #20
0
    IEnumerator Vibrate(float time)
    {
        while (time > 0)
        {
            if (!ManagerPause.Pause)
            {/*/
              * if(InputEnum.GamePad.ToString() == "xbox 360")
              * {
              *     Handheld.Vibrate();
              *
              * }
              * /*/
#if UNITY_PS4 && !(UNITY_EDITOR)
                PS4Input.PadSetVibration(0, IntensityMayor, IntensityMinor);
#endif
                time -= Time.deltaTime;
            }
            yield return(null);
        }

#if UNITY_PS4 && !(UNITY_EDITOR)
        PS4Input.PadSetVibration(0, 0, 0);
#endif
    }
예제 #21
0
파일: VRInput.cs 프로젝트: Jurosale/LiftVR
    public static bool getRightTriggerDown()
    {
#if UNITY_PS4
        if (PS4Input.MoveGetAnalogButton(0, 0) > 0 && priorRight == false)
        {
            return(true);
        }
        else
        {
            return(false);
        }
#else
        if (rightController.GetPress(triggerButton) && priorRight == false)
        {
            //Debug.Log("trig press R");

            return(true);
        }
        else
        {
            return(false);
        }
#endif
    }
예제 #22
0
    //---------------------------------------------------------------

    /*
     *  @brief      最初のロケット噴射
     */
    //---------------------------------------------------------------
    public void FirstFire()
    {
        Vector3 vForward = attachedObject.transform.forward;
        float   power    = InitialRocketPower;
        float   angle    = InitialRocketAngle;

        Vector3 outVelocity;
        bool    bLaunch = SetupRocketOrbit(out outVelocity, vForward, angle, power);

        if (bLaunch)
        {
            objScript.SetupBlowoffParam(outVelocity, ForceMode.VelocityChange);
            GenerateExplosion();
        }

        m_rocketPower = 0.0f;
        m_state       = EItemUseState.ITEM_STAT_USING;

        base.OnFire();

#if UNITY_PS4
        PS4Input.PadSetVibration(0, 255, 0);
#endif  //
    }
    void Init()
    {
        Sony.NP.Main.OnAsyncEvent += Main_OnAsyncEvent;

        Sony.NP.InitToolkit init = new Sony.NP.InitToolkit();

        init.contentRestrictions.DefaultAgeRestriction = 2;

        Sony.NP.AgeRestriction[] ageRestrictions = new Sony.NP.AgeRestriction[1];

        ageRestrictions[0] = new Sony.NP.AgeRestriction(10, new Sony.NP.Core.CountryCode("en"));
        //ageRestrictions[1] = new Sony.NP.AgeRestriction(15, new Sony.NP.Core.CountryCode("au"));

        init.contentRestrictions.AgeRestrictions = ageRestrictions;

        // Only do this if age restriction isn't required for the product. See documentation for details.
        // init.contentRestrictions.ApplyContentRestriction = false;

        init.threadSettings.affinity = Sony.NP.Affinity.AllCores; // Sony.NP.Affinity.Core2 | Sony.NP.Affinity.Core4;

        // Mempools
        init.memoryPools.JsonPoolSize = 6 * 1024 * 1024;
        init.memoryPools.SslPoolSize *= 4;

        init.memoryPools.MatchingSslPoolSize *= 4;
        init.memoryPools.MatchingPoolSize    *= 4;

        init.SetPushNotificationsFlags(Sony.NP.PushNotificationsFlags.None);
        init.contentRestrictions.DefaultAgeRestriction = 0;

        //You can add several age restrictions by region


        //For this example we use the first user

        loggedInUser = PS4Input.RefreshUsersDetails(0);

        try
        {
            initResult = Sony.NP.Main.Initialize(init);

            if (initResult.Initialized == true)
            {
                Debug.LogError("NpToolkit Initialized ");
                Debug.LogError("Plugin SDK Version : " + initResult.SceSDKVersion.ToString());
                Debug.LogError("Plugin DLL Version : " + initResult.DllVersion.ToString());
                //
                RegisterTrophyPack();
            }
            else
            {
                Debug.LogError("NpToolkit not initialized ");
            }
        }
        catch (Sony.NP.NpToolkitException e)
        {
            Debug.LogError("Exception During Initialization : " + e.ExtendedMessage);
        }
#if UNITY_EDITOR
        catch (DllNotFoundException e)
        {
            Debug.LogError("Missing DLL Expection : " + e.Message);
            Debug.LogError("The sample APP will not run in the editor.");
        }
#endif
    }
예제 #24
0
    //---------------------------------------------------------------

    /*!
     *  @brief      ロケット発射処理その2
     *  @note       押してる間はパワーためる
     *         離したら発射
     */
    //---------------------------------------------------------------
    public bool OnFire2()
    {
        if (m_state == EItemUseState.ITEM_STAT_USING)
        {
            if (m_reloadTime < ReloadTimer)
            {
                return(false);
            }
        }

        Vector3 vForward = Vector3.zero;
        float   angle    = 0.0f;

        if (Input.GetButton("Circle"))
        {
            if (!m_bChargeStart)
            {
                PlayCharge();
                m_bChargeStart = true;
            }

            m_rocketPower += 0.01f;
            if (m_rocketPower >= 1.0f)
            {
                m_rocketPower = 1.0f;
            }

#if UNITY_PS4
            PS4Input.PadSetVibration(0, 0, (int)(255 * m_rocketPower));
#endif  //
        }
        else if (Input.GetButtonUp("Circle"))
        {
            StopSE();
            m_bChargeStart = false;

            Quaternion camRot = scrCamera.hmdOrientation;
            float      power  = 0.0f;
            if (m_state == EItemUseState.ITEM_STAT_READY)
            {
                vForward = attachedObject.transform.forward;
                power    = InitialRocketPower;
                angle    = InitialRocketAngle;
            }
            else if (m_state == EItemUseState.ITEM_STAT_USING)
            {
                vForward = objScript.RigidBody.velocity;
                power    = AddMaxPower;
                angle    = AddMaxAngle * m_rocketPower;
            }

            Vector3 outVelocity;
            bool    bLaunch = SetupRocketOrbit(out outVelocity, vForward, angle, power);

            if (bLaunch)
            {
                objScript.SetupBlowoffParam(outVelocity, ForceMode.VelocityChange);
                GenerateExplosion();
            }

            m_rocketPower = 0.0f;
            m_state       = EItemUseState.ITEM_STAT_USING;

            base.OnFire();

#if UNITY_PS4
            PS4Input.PadSetVibration(0, 255, 0);
#endif  //

            return(true);
        }
        // ウンコー
        else if (Input.GetButton("Triangle"))
        {
            m_state = EItemUseState.ITEM_STAT_READY;
        }
        else
        {
            m_rocketPower -= 0.01f;
            if (m_rocketPower < 0.0f)
            {
                m_rocketPower = 0.0f;
            }
        }


        return(false);
    }
예제 #25
0
    public void ResetColor()
    {
#if UNITY_PS4 && !(UNITY_EDITOR)
        PS4Input.PadResetLightBar(PS4Input.PadGetUsersDetails(0).userId);
#endif
    }
예제 #26
0
    void Touchpad()
    {
        PS4Input.GetPadControllerInformation(playerId, out touchPixelDensity, out touchResolutionX, out touchResolutionY, out analogDeadZoneLeft, out analogDeadZoneRight, out connectionType);
        PS4Input.GetLastTouchData(playerId, out touchNum, out touch0x, out touch0y, out touch0id, out touch1x, out touch1y, out touch1id);

        // Show and move around up to 2 touch inputs
        if (touchNum > 0)
        {
            float xPos = 0;
            float yPos = 0;

            // Touch 1
            if (touch0x > 0 || touch0y > 0)
            {
                if (!touches[0].gameObject.activeSelf)
                {
                    touches[0].gameObject.SetActive(true);
                }

                xPos = (3.57f / touchResolutionX) * touch0x;
                yPos = (1.35f / touchResolutionY) * touch0y;

                touches[0].localPosition = new Vector3(xPos, -yPos, 1);
            }
            else if (touches[0].gameObject.activeSelf)
            {
                touches[0].gameObject.SetActive(false);
            }

            //Touch 2
            if (touchNum > 1 && (touch1x > 0 || touch1y > 0))
            {
                if (!touches[1].gameObject.activeSelf)
                {
                    touches[1].gameObject.SetActive(true);
                }

                xPos = (3.57f / touchResolutionX) * touch1x;
                yPos = (1.35f / touchResolutionY) * touch1y;

                touches[1].localPosition = new Vector3(xPos, -yPos, 1);
            }
            else if (touches[1].gameObject.activeSelf)
            {
                touches[1].gameObject.SetActive(false);
            }
        }
        else if (touches[0].gameObject.activeSelf || touches[1].gameObject.activeSelf)
        {
            touches[0].gameObject.SetActive(false);
            touches[1].gameObject.SetActive(false);
        }

        // Make the touchpad light up and play audio if it's pushed down
        if (Input.GetKey((KeyCode)Enum.Parse(typeof(KeyCode), "Joystick" + stickID + "Button6", true)))
        {
            gamePad.touchpad.color = inputOn;
            TouchpadAudio(touchResolutionX, touchResolutionY, touch0x, touch0y);
        }
        else
        {
            gamePad.touchpad.color = inputOff;
            GetComponent <AudioSource>().Stop();
        }
    }
예제 #27
0
    void MouseInputSelection()
    {
#if UNITY_PS4 && !UNITY_EDITOR
        PS4Input.GetPadControllerInformation(playerId, out touchPixelDensity, out touchResolutionX, out touchResolutionY, out analogDeadZoneLeft, out analogDeadZoneRight, out connectionType);
        PS4Input.GetLastTouchData(playerId, out touchNum, out touch0x, out touch0y, out touch0id, out touch1x, out touch1y, out touch1id);
#endif


        if (
#if UNITY_PS4 && !UNITY_EDITOR
            touchNum > 0
#elif UNITY_PSP2 && !UNITY_EDITOR
            Input.touchCount == 1
#else
            Vector2.Distance(storeMouse, Input.mousePosition) > 0.5f
            //Input.GetMouseButton(0)
#endif
            )
        {
#if UNITY_PS4 && !UNITY_EDITOR
            if (touch0x > 0 || touch0y > 0)
            {
#endif
            if (!m_touchSpawned.gameObject.activeSelf)
            {
                m_touchSpawned.gameObject.SetActive(true);
            }

            float xDraw = 0;
            float yDraw = 0;
#if UNITY_PS4 && !UNITY_EDITOR
            // m_touchSpawned.position = Camera.main.ScreenToWorldPoint(new Vector3(touch0x, touchResolutionY - touch0y, 9));
            xDraw  = (1.0f / touchResolutionX) * touch0x;
            xDraw -= 0.5f;
            xDraw *= ScaleFactorX;
            xDraw += 0.5f;
            xDraw *= Screen.width;

            yDraw  = (1.0f / touchResolutionY) * touch0y;
            yDraw  = 1 - yDraw;
            yDraw -= 0.5f;
            yDraw *= ScaleFactorY;
            yDraw += 0.5f;
            yDraw *= Screen.height;

            // m_touchSpawned.position = (new Vector3(xDraw, -yDraw, 9));
#elif UNITY_PSP2 && !UNITY_EDITOR
            xDraw = Input.touches[0].position.x;
            yDraw = Input.touches[0].position.y;
#else
            xDraw = Input.mousePosition.x;
            yDraw = Input.mousePosition.y;
#endif
            Ray ray = Camera.main.ScreenPointToRay(new Vector3(xDraw, yDraw, 0));
            m_touchSpawned.position = ray.origin;
            if (Physics.Raycast(m_touchSpawned.position, Vector3.forward, out hit, 100, PlatformMask))
            {
                hit.collider.GetComponent <Input3DSelection>().SelectByInput();
            }
#if UNITY_PS4 && !UNITY_EDITOR
        }
        else if (m_touchSpawned.gameObject.activeSelf)
        {
            m_touchSpawned.gameObject.SetActive(false);
        }
#endif
        }