I’ve just started out with Unity, so apologies if this is a stupid question, but I’ve searched high and low for an answer.
I have a camera that is pointing downwards at a 45 degree angle(45,0,0), and it will always remain at this angle. You can rotate the camera around a fixed point(A fake gameObject following the focal point of the camera). The bit I am struggling with is the panning of the camera. I want it to pan across a fix plane, so it should not move up or down, only left, right, forward or backwards. Because of the rotation the left/right movement is just a world.self translate, but when I try to translate the forward/backward movement it moves relative to the camera and starts to move along both the Y and Z axis(Essentially zooming in).
I tried setting the translate to self.world, which works ok at the start, but when you rotate the camera it continues to move along worlds Z axis which is wrong.
So I want to pan across the Z world axis, but in a relative direction to the cameras rotation.
I hope I explained that all ok Here’s the parts of my movement code that are relevant.
transform.Translate(horzMoveAmt,0.0f,0.0f,Space.Self);
//Does not work when rotated
transform.Translate(0.0f,0.0f,vertMoveAmt,World.Self);