Skip to content

Commit

Permalink
Fixed a problem with touch raycasting
Browse files Browse the repository at this point in the history
  • Loading branch information
Stolous committed May 14, 2017
1 parent 93709b4 commit c62e521
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 1 deletion.
Binary file modified Assets/Scenes/Game.unity
Binary file not shown.
3 changes: 2 additions & 1 deletion Assets/Scripts/Player/TankMovements.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ void Update()
{
ray = Camera.main.ScreenPointToRay((Vector3)Input.GetTouch(i).position);
RaycastHit hit;
if(Physics.Raycast(ray, out hit, LayerMask.NameToLayer("Ground")) && !EventSystem.current.IsPointerOverGameObject(Input.GetTouch(i).fingerId))
if(canFire && tank.health > 0 && Physics.Raycast(ray, out hit, LayerMask.NameToLayer("Ground")) && !EventSystem.current.IsPointerOverGameObject(Input.GetTouch(i).fingerId))
{
headTransform.LookAt(new Vector3(hit.point.x, headTransform.position.y, hit.point.z));
CmdSpawnMissile(missileSpawn.position);
canFire = false;
}
}
}
Expand Down
Binary file modified ProjectSettings/ProjectSettings.asset
Binary file not shown.

0 comments on commit c62e521

Please sign in to comment.