I have a very simple script to move the camera left and right (using “A” or “D” for “left” and “right”).
I notice that the camera has a jittery problem,
anyone know what might causing the problem ?
(it looks worse in Firefox, but slightly ok with Safari)
this only happens in the Web version, it’s not happening if i build the executeable version (OS X).
Here is what i tried so far:
the scene itself is very simple, only one camera and couple houses, no other script running (except that FramePerSecond script)
1. First Try:
using this script and assign it to Camera
function SimpleInput()
{
if (Input.GetButton("left"))
{
transform.Translate(-Time.deltaTime * 5, 0, 0);
}else if (Input.GetButton("right"))
{
transform.Translate(Time.deltaTime * 5, 0, 0);
}
}
function Update () {
SimpleInput();
}
Result:
http://anicombo.com/unity/CameraJitter.html
2. Second Try:
using InputAxis instead of GetButton
function AxisInput()
{
var moving = Input.GetAxis ("Horizontal") * 5;
moving *= Time.deltaTime;
transform.Translate (moving, 0, 0);
}
function Update () {
AxisInput();
}
Result:
http://anicombo.com/unity/CameraAxis.html
3. And last try,
this one is slightly different, instead of actually moving the camera i’m using “SmoothFollow.js” script, i make an empty object as my target, and assign it to the Camera, and moving the empty object (target) instead of the camera itself.
Result:
http://anicombo.com/unity/CameraSmoothFollow.html
Looks like all of them have the same jittery problem,
anyone could help me find the solution ?
thanks a lot in advance