1
\$\begingroup\$

Assume a shooting game for iPhone that the character shoot toward where player has touched.

But as we know, There may be fault in touching screen by player and it conclude to bad game play and low fun.

So, How can I correct shooting method ?

\$\endgroup\$
2
  • \$\begingroup\$ you could try using 3D picking to detect what object the pixel at the point touched belongs to. Since fingers aren't the size of individual pixels you might want to check for a group of pixels around the touch point, maybe a radius of 5 would work. \$\endgroup\$ Oct 31 '12 at 21:16
  • \$\begingroup\$ When you the touch screen at (X,Y), you need to projectile the point to 3D world, and then it gives you an origin point(the cone top) and a vector of direction. And the problem is about this direction vector. You said to check all of some close point to (X,Y) and It's a solution too. But It cost more, because you should do Trace action for more point ( many point needed to get a good result ). \$\endgroup\$
    – Emadpres
    Oct 31 '12 at 21:21
1
\$\begingroup\$

I think when player touch a point, he target some thing that will place in a cone as below picture show.

enter image description here

So, we just need to check collision of objects in this cone, and if any exist, the player most probably decided to shoot at it.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.