Hi, I'm trying to get a camera, pointing down towards a rectangle, to move on the x axis using the accelerometer and, at the same time, to always point at the center of the rectangle (which is, coordinates 0,0,0). So, the camera should move and rotate to always look at the center of the rectangle. The purpose is to give a sense of "false 3D", for lack of a better description.
I can make the camera move, but I can't make it rotate accordingly. When I use lookAt, the whole thing spins on the y axis instead of rotating on z axis. It looks like I can't use transform.translate and lookAt in the same function.
I'm really at a loss, here. I literally can't think of any way to fix this. It would be awesome if someone could help.
Anyway, here is the code I'm using to make it move. What should I add/change?
Your problem is using Translate without a specific second parameter of Space.world - currently the translation happens in the rotation of the object - which gives you the spinning effect. You presumably want movement in world coordinates and then the look at should keep it centered...
answered Jul 26 '12 at 09:22 PM