I have this game called Sonic Boom:
https://play.google.com/store/apps/details?id=com.coolfone.sonicboom
When you touch a screenpoint, it tries to move the spaceship to it.
I didn’t use Unity for it, but I’d like to make a Unity version.
Anyone know how to make it so I can take the screen coords of a touch and figure out where in world coordinates the spaceship should try to go?
I suspect I didn’t really do it quite right when I made the current version without Unity.
I’m thinking of having the camera maybe at 0,0,-10.
And maybe the spaceship will start at 0,0,0 and always have a z value of 0.
So, I’m thinking maybe I should have a ray going from the camera through the point in the near clipping plane. Then, somehow I want to see where the ray is when z=0.
Also, I’m looking at this function and wondering if it will work:
However, I am sorely confused about the z value that is being passed in for a screen point.
It makes much more sense to me for the screen point to be an x and y without a z.
I may try to use this one since it seems to make more sense:
It says position.z is ignored, which makes sense to me.
Then somehow I would want to take that Ray and find out where it is when z=0. Anyone know how to do that?
Thanks. Have a blessed day.