I wanted make object move constantly upwards at same speed for every screen resolution.
Also want to rotate when pressed left or right side of the screen. But both rotation speed and character speed changes when screen res. changes. I fixed that problem with adding Time.deltaTime but Time.deltaTime isn’t constant so it makes character movement laggy. These are the codes. Please help me. Thanks in advance…
void Update () {
gameObject.transform.position += new Vector3(0, speed*Time.deltaTime, 0);
if (Input.GetMouseButton(0) == true && gameOver == false)
{
touchX = Input.mousePosition.x;
{
if (touchX < Screen.width/2)
{
a++;
transform.rotation = Quaternion.Euler(0, 0, 1 * (a*rotateSpeed* Time.smoothDeltaTime));
if (a == 360 / rotateSpeed)
{
a = 0;
}
}
else
{
a--;
transform.rotation = Quaternion.Euler(0, 0, 1 * (a * rotateSpeed* Time.smoothDeltaTime));
if (a == -360/rotateSpeed)
{
a = 0;
}
}
}
}
}