|
I'm unable to get a consistently accurate touch.position or hit.point using the following script. Touching the screen prints the following targetLocation to the console: 16.8, 6.1, 0.0
I've also tried getting the touch position in the following ways, but each of them has the same random inaccuracy.
Any suggestions on where I might be going wrong?
(comments are locked)
|
|
Turns out that the problem is not with the code, but rather with my scene. Since I'm making a 2D side-scroller, I didn't have any collision on the background (nothing ever moves in Z so why would I need collision there?). After adding a collision box across my background, I am now getting accurate touch.position and hit.point.
(comments are locked)
|
|
I'm not very fermiliar with iPhone specifics, but since your question hasn't had an answer yet, I'll shoot anyway: It looks like you're not correctly dealing with the situation where there would be more than one touches. Instead of dealing with all of them, you currently deal with none of them. You only do something if there is exactly one touch. In this example yes I'm only allowing 1 touch at a time. But that shouldn't affect the touch position. I suspect the problem might lie in the difference between touch.position and hit.point (both of those return different values). But I'm not sure how to get the "correct" point on screen.
Dec 23 '09 at 10:32 PM
rocket5tim
(comments are locked)
|
