Hi,
For my Android game I have animated a character with mecanim. When I touch this character, it starts walking (see script).
function Update ()
{
for (var touch: Touch in Input.touches)
{
if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
{
var ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);
var hit: RaycastHit;
if(Physics.Raycast(ray, hit))
{
// start walking
}
}
}
}
Now I have a second character. It’s a duplicate of the first one but all the names, animator controller, etc are changed. But when I hit one of the characters, both characters are walking. What I would like to have is that only the character that you hit is gonna walk.
I think I have overlooked something. Why is there a connection between the two different raycasts?