I'm making a 2.5D archery game for a university project and having some trouble spawning the arrows pointing at the mouse position.
I'm working with the coords y=vertical, x=horizontal, z=depth (but not seen due to orthographic camera).
Essentially I want an arrow to be instantiated at the players position pointing at the mouse (the x,y of the mouse - where z is always 0), it should be simple enough although I'm having some real trouble with getting the rotation correct.
transform.LookAt doesn't seem to work too well in the 2.5d space.
Any help would be greatly appreciated, Hawk
if you build your 2.5D univers in real 3D coords, the lookAt should work in both perspective and orthographic camera.
are you sure that your objects are aligned correctly to the right axis? Eg. if you export from Blender the Z and Y is oppersite and that could be the problem.
Regarding the mousepos, there is something called ScreenToWorld and WorldToScreen + a bunch of similar calculations/functions available for such translations.
Here is just one of them, I recommend you take a look at see if there is anything usefull in it.
answered Nov 16 '11 at 10:43 PM