cancel
Showing results for 
Search instead for 
Did you mean: 

Camera movement as Horizontal and Vertical inputs

octaspace
Honored Guest
I would like to use the camera movements as the "Horizontal" and "Vertical" inputs in Unity. This is what i wrote so far but no success, any help would be great!
using UnityEngine;
using System.Collections;

public class CamMoving : MonoBehaviour {



void Update ()
{

float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");



Camera.main.ScreenToWorldPoint(new Vector3 (moveHorizontal, moveVertical, 0));
}
}
3 REPLIES 3

cybereality
Grand Champion
That code doesn't make any sense to me.

Can you maybe try to explain what your end goal is? There might be another way.

octaspace
Honored Guest
Still a beginner here but my motivation to get better in c# is very strong! 😛 So i got this first person shooter package and I'm trying to use it for my vr project. Strangely the aiming of the guns is not connected with the camera view, so you can just aim with the mouse or assign it to a Vertical or Horizontal value for like an gamepad. I'm trying to figure out for days how I can get the aiming with the camera view to work which is better for vr. Maybe you have an idea how I can solve that, thx!

aaron_ratdoggam
Honored Guest
It sounds like you want to use head tracking as input.  Unity's Input object doesn't provide that.   You will need to use OVRInput.   Read the documentation on this site about how to get set up (if you don't already have OVRInput in your project) and for details on how to use it.