Before updating to Windows 10 you may need to return your Pro license. More information here

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

more ▼

asked Dec 10, 2010 at 02:03 AM

avatar image

13 6 4 6

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: Dec 10, 2010 at 02:03 AM

Seen: 1588 times

Last Updated: Dec 10, 2010 at 02:03 AM