- Home /
how to make multi-touch for 3d models
I have got this script for gui texture but how would I change it to 3d models help please anyone here is the script
using UnityEngine;
using System.Collections;
public class TouchLogic: MonoBehaviour {
5.
void Update (){ // enclose the Update function in curly braces
//is there a touch on screen
if (Input.touches.Length <= 0) // <- no touches means <= 0, not < 0
{
10. //if no touches then execute this code
}
else // <- there are no parenthesis after else!
{
//loop through all of the touches on the screen
15. for (int i=0; i < Input.touchCount; i++ )
{
//execute this code for current touch (i)on screen
if(this.guiTexture.HitTest(Input.GetTouch (i).position ))
{
20. //if current touch hits our guitexture, run this code
if(Input.GetTouch (i).phase == TouchPhase.Began )
{
Debug.Log("the touch has begun on" +this.name);
}
25. if(Input.GetTouch (i).phase == TouchPhase.Ended )
{
Debug.Log("the touch has ended on" +this.name);
}
}
30. }
}
}
}
Comment
These should get you going >>>
http://docs.unity3d.com/Documentation/$$anonymous$$anual/Input.html
http://docs.unity3d.com/Documentation/ScriptReference/Physics.Raycast.html
http://docs.unity3d.com/Documentation/ScriptReference/Collider.Raycast.html
http://answers.unity3d.com/questions/237959/select-an-object-with-touch-android.html
Your answer
Follow this Question
Related Questions
How to Make a Pixel/Retro Texture for a Game? 2 Answers
3D Playermodel 1 Answer
Model issue [Screenshot] 0 Answers