3D Space Sim Mouse Look Problems

I’m making a small 3d space game with the first person player as a ship. The first issue I ran into is the Mouse Look script. When I set the min/max values to ±360 some strange things started to happen. When I look down past 90 degrees, the camera “inverts” the left/right mouse axis, moving the mouse right moves the camera left and vice vercia. I think this has to do with the rotation being off the “world” axis instead off the camera’s axis. What needs to be changed to fix this?

Also what is the best way to implement a “laggy mouse” effect, so the mouselook isnt so choppy? Something like the smoothLookAt script. If it makes any difference, the controller will be a joystick.

  • bump

first of all, im not a unity guru, and the following may be all so wrong or the worst way to do it, but even with the lack of my knowledge i came up with this:

using UnityEngine;
using System.Collections;

public class obj_Free: MonoBehaviour {
	public float Sensitivity = 15.0f;
		float mmX = 45.0f;
		float mmY = 0.0f;

	// Update
	void Update () {
		mmX = Input.GetAxis("Mouse X");
		mmY = Input.GetAxis("Mouse Y")*-1.0f;
		if(mmX != 0.0f) 
			transform.Rotate(0.0f, mmX*Sensitivity, 0.0f, Space.Self);
		if(mmY != 0.0f) 
			transform.Rotate(mmY*Sensitivity, 0.0f, 0.0f, Space.Self);
	}
}

I could make you a much better complete space movement with trigonometry alone, but i just have to learn unity first :slight_smile: