- Home /
Mouselook in space, without a 'down' or 'up'
I'm planning to make a game that allows you to fly around in outer space, and it's important for the 'space' feel that there is no 'down' or 'up'. For example, in a standard FPS on the ground, when you look all the way up, your character can't look up any further. On top of that, if you move the mouse to the side, your character spins around but is still aiming at the same point, directly above him.
I need to make a camera that, even if you're looking straight 'up' from the original orientation, moving the mouse to the left makes your aim move to the left exactly the same way as if you were turning left while aiming at the horizon in a standard FPS. This would result in your view of the "world" (outer space) becoming tilted, but that's the point. Also, there shouldn't be anything stopping the camera from tilting 'up' so far that it flips over altogether.
Can anyone give me advice on how to implement such a camera?
With an arbitrary frame of reference, you will have a real problem making the movements be intuitive. For example say you don't play any limits so that there is nothing stopping the camera from flipping over. As the camera rotates over the top, your movements become reversed. That is, code moving your cursor up, now moves the camera down. For most situations, this is really disconcerting for users, and it may not be easily fixed.
Answer by grahnzz · Apr 19, 2014 at 01:53 AM
reference the local axes instead of world
//rotate around local y.
this.transform.Rotate(Vector3.up,Input.GetAxis("Mouse X"),Space.Self);
//rotate around local x;
this.transform.Rotate(Vector3.right,-Input.GetAxis("Mouse Y"),Space.Self);
feels pretty weird
Your answer
Follow this Question
Related Questions
Why wont my camera controller work,Why isnt my script working for a camera controller? 1 Answer
First Person Camera switch to Third Person Camera on Object 2 Answers
Restrict Scaling of Object due to camera position and angle. 1 Answer
Problem with mouse look and second skybox cam 0 Answers
Resetting Camera with a key input 1 Answer