Z
Z
Zefirot2021-06-06 17:51:34
Unity
Zefirot, 2021-06-06 17:51:34

Why is Lerp slower on a smartphone?

I do the usual moving to a point using Lerp, everything works fine and at the right speed, I put the same test on a smartphone and everything happens there, but 3 times slower, why can this be?

void Update(){
    Test.transform.position = Vector3.Lerp(Test.transform.position, TargetPosition, 5f * Time.deltaTime);
    }

The resolution in the editor and on the phone is the same...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AlexHell, 2021-06-10
@AlexHell

where do you learn how to write such a LERP with a dynamic starting point? to move at a uniform speed, you need to take the starting point and the end point as static, changing only the interpolation coefficient from 0 to 1
, for example (you can also do initialization in your own way)

public GameObject Test;
public Vector3 StartPosition;
public Vector3 TargetPosition;
void Start() {
  StartPosition = Test.transform.position;
}
void Update(){
    Test.transform.position = Vector3.Lerp(StartPosition, TargetPosition, 5f * Time.deltaTime);
    }

what you originally wrote may wildly depend on both the FPS and the device error, and just do it crookedly. does not express intentions (from where to where for how much should it move?)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question