Question by
Hooman-BZ-1989 · Apr 17, 2017 at 07:25 PM ·
c#androidunity 5camera
How to move camera with Input.GetAxis() and my camera view direction?!!
Public GameObject Camera1;
void Update () {
float h = Input.GetAxis("Horizontal");
float v = Input.GetAxis("Vertical");
Camera1.transform.Translate(h * 0.01f, 0f, v * 0.01f);
}
Its my code to move the camera but the problem is when i change the camera direction it goes at the direction that it was.... I just want to make my camera go straight at my camera direction when im going forward??!!!! Please help me ...its killing me!!!!
Comment
Answer by pogotc · May 01, 2018 at 08:43 PM
Try making the camera a child object of an empty game object and move this script onto the empty game object. It should then work how you're expecting it to.
Your answer
![](https://koobas.hobune.stream/wayback/20220612115935im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to change camera on Android? 1 Answer
dynamically changing texture of an object 1 Answer
My first game published made with unity 0 Answers
How to move the camera in VR mode? 2 Answers