swat243 Geschrieben 12. Oktober 2015 Melden Share Geschrieben 12. Oktober 2015 Guten Abend Leute, Also ich habe das Problem,das TouchPhase.Ended garnicht abfeuert,ich möchte mit TouchPhase.Ended erreichen das die bools forward = false; back = false; left = false; right = false; gehen,aber es funktioniert einfach nicht und ich kann es mir nicht erklären,ich bin noch recht neu in Touch. Das zweite Problem ist,dass TouchPhase.Moved scheinbar nur ein Frame abgibt beim Touch :/ Also ich möchte auf dem Touch Point mit meinem Spieler Zielen. if(Input.touchCount > 0) { Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position); RaycastHit hit; if(Input.GetTouch(0).phase == TouchPhase.Began) { if(Physics.Raycast(ray,out hit)) { if(Input.GetTouch(0).phase == TouchPhase.Began) { if(hit.collider.tag == "forward"){forward = true;none_walk = false; } if(hit.collider.tag == "back"){back = true;none_walk = false; } if(hit.collider.tag == "right"){right = true;none_walk = false; } if(hit.collider.tag == "left"){left = true;none_walk = false; } if(hit.collider.tag == "terrain"){ forward = false;back = false;right = false;left = false; none_walk = true;} if(hit.collider.tag == "aim_field") { if(Still_one_touch_to_aim_on_1 == false &&Still_one_touch_to_aim_on_2 == false &&Still_one_touch_to_aim_on_3 == false &&Still_one_touch_to_aim_on_4 == false &&Still_one_touch_to_aim_on_5 == false &&Still_one_touch_to_aim_on_6 == false &&Still_one_touch_to_aim_on_7 == false &&Still_one_touch_to_aim_on_8 == false &&Still_one_touch_to_aim_on_9 == false &&Still_one_touch_to_aim_on_10 == false) { Still_one_touch_to_aim_on_1 = true; } if(Still_one_touch_to_aim_on_1 == true) { Vector3 vec = hit.point-transform.position; Quaternion Aim_at = Quaternion.LookRotation(vec); Aim_at.x =0; Aim_at.z =0; transform.rotation = Aim_at; } } } if(Input.GetTouch(0).phase == TouchPhase.Stationary) { Physics.Raycast(ray,out hit); if(hit.collider.tag == "forward"){forward = true;none_walk = false; } if(hit.collider.tag == "back"){back = true;none_walk = false; } if(hit.collider.tag == "right"){right = true;none_walk = false; } if(hit.collider.tag == "left"){left = true;none_walk = false; } if(hit.collider.tag == "terrain"){ forward = false;back = false;right = false;left = false; none_walk = true;} if(hit.collider.tag == "aim_field") { if(Still_one_touch_to_aim_on_1 == false &&Still_one_touch_to_aim_on_2 == false &&Still_one_touch_to_aim_on_3 == false &&Still_one_touch_to_aim_on_4 == false &&Still_one_touch_to_aim_on_5 == false &&Still_one_touch_to_aim_on_6 == false &&Still_one_touch_to_aim_on_7 == false &&Still_one_touch_to_aim_on_8 == false &&Still_one_touch_to_aim_on_9 == false &&Still_one_touch_to_aim_on_10 == false) { Still_one_touch_to_aim_on_1 = true; } if(Still_one_touch_to_aim_on_1 == true) { Vector3 vec = hit.point-transform.position; Quaternion Aim_at = Quaternion.LookRotation(vec); Aim_at.x =0; Aim_at.z =0; transform.rotation = Aim_at; } } } if(Input.GetTouch(0).phase == TouchPhase.Moved) { Physics.Raycast(ray,out hit); if(hit.collider.tag == "forward"){forward = true;none_walk = false; } if(hit.collider.tag == "back"){back = true;none_walk = false; } if(hit.collider.tag == "right"){right = true;none_walk = false; } if(hit.collider.tag == "left"){left = true;none_walk = false; } if(hit.collider.tag == "terrain"){ forward = false;back = false;right = false;left = false; none_walk = true;} if(hit.collider.tag == "aim_field") { if(Still_one_touch_to_aim_on_1 == false &&Still_one_touch_to_aim_on_2 == false &&Still_one_touch_to_aim_on_3 == false &&Still_one_touch_to_aim_on_4 == false &&Still_one_touch_to_aim_on_5 == false &&Still_one_touch_to_aim_on_6 == false &&Still_one_touch_to_aim_on_7 == false &&Still_one_touch_to_aim_on_8 == false &&Still_one_touch_to_aim_on_9 == false &&Still_one_touch_to_aim_on_10 == false) { Still_one_touch_to_aim_on_1 = true; } if(Still_one_touch_to_aim_on_1 == true) { Vector3 vec = hit.point-transform.position; Quaternion Aim_at = Quaternion.LookRotation(vec); Aim_at.x =0; Aim_at.z =0; transform.rotation = Aim_at; } } } if(Input.GetTouch(0).phase == TouchPhase.Ended) { Still_one_touch_to_aim_on_1 = false; forward = false; none_walk = true; back = false; right = false; left = false; } } } } Ich hoffe sehr Um Hilfe Link zu diesem Kommentar Auf anderen Seiten teilen More sharing options...
swat243 Geschrieben 12. Oktober 2015 Autor Melden Share Geschrieben 12. Oktober 2015 Problem gelöst hatte alles aus versehen in einer Phase Began gepackt ^^° Link zu diesem Kommentar Auf anderen Seiten teilen More sharing options...
6-huber Geschrieben 13. Oktober 2015 Melden Share Geschrieben 13. Oktober 2015 Versuchst du eigentlich deine probleme auch selbst zu lösen bevor du sie postest Link zu diesem Kommentar Auf anderen Seiten teilen More sharing options...
Recommended Posts
Archiviert
Dieses Thema ist jetzt archiviert und für weitere Antworten gesperrt.