I have these saws that move around those trails in pairs and at a constant speed. When I test this on my computer with good FPS it all works great and they move as intended.
But when I test it on iPad (low and oscillating FPS) the saws in each pair start to move differently, sometimes they get closer to each other and other times they get farther away. I’m having an hard time coming up with a solution for this, maybe you guys can help me.
This is my Update function:
private void Update(){
//Saw Rotation
BladeTransform.rotation *= Quaternion.AngleAxis(SawRotSpeed*360*Time.deltaTime, -transform.forward);
//Saw Movement
transform.position = Vector3.Lerp(_curStartPos, _destinyPos, _sawTimer);
if (_sawTimer < 1) _sawTimer += (Time.deltaTime*1.2f*TilesPerSec)/_distanceNextWaypoint;
else{
_sawTimer = 0;
_curStartPos = transform.position;
if (Inverse){
if (_destinyWaypoint == 0) _destinyWaypoint = WayPoints.Count - 1;
else _destinyWaypoint--;
}
else{
if (_destinyWaypoint >= (WayPoints.Count - 1)) _destinyWaypoint = 0;
else _destinyWaypoint++;
}
_destinyPos = WayPoints[_destinyWaypoint].position;
_distanceNextWaypoint = Vector3.Distance(_destinyPos, _curStartPos);
}
}
I use the common method of:
Timer = 0;
Lerp(start,end,Timer);
if(Timer<1) Timer+=Time.deltatime;
I always used this for movement but never on a situation where I needed two objects to be synchronised with each other, am I doing something wrong or is there any other way of doing this on which I can have these saws synchronised with each other?