- Home /
Help with code logic iPhone Touch FPS
How do I make this script fires a projectile in the z axis? I tried adding: transform.position.z
that did not work.
function Update () { for (var i = 0; i < iPhoneInput.touchCount; ++i) { if (iPhoneInput.GetTouch(i).phase == iPhoneTouchPhase.Began) { clone = Instantiate (bullet, transform.position, transform.rotation); audio.PlayOneShot(pistolsfx);
} } }
How do i get it to shoot the projectile where I tap? This the script used to create the crosshair.
function OnGUI() {
var pos = iPhoneInput.GetTouch(0).position; var texRect = new Rect(pos.x - reticle.width / 2, pos.y - reticle.height / 2, reticle.width, reticle.height);
GUI.DrawTexture(texRect, reticle);
}
The crosshais only show up when I touch the screen. How to fix this and make projectile fire at the point where I touch the screen...
Thanks for your help in advanced