- Home /
ray cast direction callabration?
I have a 3d game start menu and in using 3dtext mesh for the options and on some devices (due to different resolutions im guessing) the ray seems to "aim low" as I need to touch above the textmesh to get a hit.
if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began) {
RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);
if (Physics.Raycast(ray,out hit))
{
if (hit.collider.tag == "txt_Play")
{
PlayerPrefs.Save ();
Application.LoadLevel("Main");
}
if (hit.collider.tag == "txt_Options")
{
if (sound==true)
{
sound = false ;
soundOption = 0;
PlayerPrefs.SetInt("SoundOption" , soundOption );
PlayerPrefs.Save ();
Debug.Log ("sound is off");
}
else
{
sound = true ;
soundOption = 1;
PlayerPrefs.SetInt("SoundOption" , soundOption );
PlayerPrefs.Save ();
Debug.Log ("sound is on");
}
}
}
}
Comment
Your answer