Hi everyone,
I have a problem, it goes like this;
At Project Settings → Input Manager, my Mouse X and Mouse Y are at their default settings.
When I use Mouse X and Mouse Y values to create a smooth movement for mouseLook script, I saw that Gravity and Dead settings in the input manager means nothing (I tried a lot of different combinations) and they don’t change the behaviour.
After seeing that those settings doesn’t help, I edited the mouseLook.cs to suit my smooth camera needs and I have a script now, which works just like intended in Unity editor. But after I build the application, smooth doesn’t work anymore.
I multiplied the values I get from mouse movement with Time.deltaTime. deltaTime had to fix the values without depending on the fps but it doesn’t.
In Unity editor, it works well with 60fps but the built version which I run in my workstation(approx 2000fps) works differently and it also works different than both on my laptop (160fps).
After that, I also tested it using FixedUpdate() and fixedDeltaTime functions and their combinations.
I also tried the smooth camera functions shared on this forum and UnifyCommunity and they have the same problems.
So I think, Input.GetAxis(“Mouse X”) and Input.GetAxis(“Mouse Y”) and even Input.GetAxisRaw(“Mouse X”) and Input.GetAxisRaw(“Mouse Y”) doesn’t get affected by deltaTime nor fixedUpdate or I couldn’t manage them to work with those.
The code below returns the value for Mouse X and it looks different in the Unity editor and Built application. How can I fix that mouse value not depending on the fps, so it works all the same without depending on the app. speed?
Thanks
private var mx; // Mouse X
private var mxR; // Mouse X Raw
private var mxDelta; // Mouse X deltaTime
private var mxRDelta; // Mouse X Raw deltaTime
function Update ()
{
Screen.lockCursor = true;
mx = Input.GetAxis("Mouse X");
mxR = Input.GetAxisRaw("Mouse X");
mxDelta = Input.GetAxis("Mouse X") * Time.deltaTime;
mxRDelta = Input.GetAxisRaw("Mouse X") * Time.deltaTime;
}
function OnGUI()
{
GUI.Label(Rect(10,10,400,20),"Mouse X = "+mx.ToString());
GUI.Label(Rect(10,30,400,20),"Mouse X Raw = "+mxR.ToString());
GUI.Label(Rect(10,50,400,20),"Mouse X Delta = "+mxDelta.ToString());
GUI.Label(Rect(10,70,400,20),"Mouse X Raw Delta= "+mxRDelta.ToString());
}