Skip to content

Instantly share code, notes, and snippets.

@gfodor
Created August 11, 2014 22:04
Show Gist options
  • Save gfodor/a888d036f210aab67d2a to your computer and use it in GitHub Desktop.
Save gfodor/a888d036f210aab67d2a to your computer and use it in GitHub Desktop.
index e33b55a..02432a8 100755
--- a/Assets/CoherentUI/Samples/Scenes/Sample03_MenuAndHUD/Game/ObjectPicker.cs
+++ b/Assets/CoherentUI/Samples/Scenes/Sample03_MenuAndHUD/Game/ObjectPicker.cs
@@ -18,6 +18,8 @@ public class ObjectPicker : MonoBehaviour {
// Update is called once per frame
void Update () {
+ Screen.lockCursor = true;
+
if (m_UISystem.HasFocusedView)
{
return;
@@ -68,7 +70,10 @@ public class ObjectPicker : MonoBehaviour {
// Activate input processing for the view below the mouse cursor
RaycastHit hitInfo;
- if (Physics.Raycast(m_MainCamera.ScreenPointToRay(Input.mousePosition), out hitInfo))
+ var width = Screen.GetResolution[0].width;
+ var height = Screen.GetResolution[0].height;
+
+ if (Physics.Raycast(m_MainCamera.ScreenPointToRay(new Vector2(width / 2.0f, height / 2.0f)), out hitInfo))
{
//Debug.Log (hitInfo.collider.name);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment