Question by
dkabanad · Feb 03, 2020 at 03:18 PM ·
camerascripting problemmovementdirection
Virtual camera odd behaviour. Scriptting noob questions
Hello everyone first of all I'm sorry for this noob question.
I am trying to prototype a game. I'm a beginner. I want to walk around relative to the camera. I tried different code but I noticed a funny behaviour. It's not about walking. I thought to calculate directions right I should use debug.drawline like follows
Debug.DrawLine(Camera.main.transform.position, Camera.main.transform.forward, Color.white);
Debug.DrawLine(Camera.main.transform.position, -Camera.main.transform.forward, Color.black);
Debug.DrawLine(Camera.main.transform.position, -Camera.main.transform.right, Color.blue);
Debug.DrawLine(Camera.main.transform.position, Camera.main.transform.right, Color.red);
But this is the result I get. As you can see blue black white and red lines are pretty funny because they dont match any axis of the camera. Can anyone help me about this.
If anyone interested I want to move directions like in the game view. Up arrow key should move up like the blue crosshair thingies up position.
Thank you very much
ekran-goruntusu-8.png
(420.0 kB)
Comment