- Home /
Object speed is much slower on iOS and Android build than on Editor
Here I am trying to move an object over an axis. Although everything is fine on editor, when I build it on iOS or android, the speed which the object is moving is not configurable. I would appreciate any help on this.
 void Update(){
 newDir = new Vector3(joystickDirection.x, movementAxis.y, joystickDirection.y);
 
 angle = Vector3.Dot(movementAxis, newDir);
 
  if (angle > 0)
      relativeDirection = 1;
  else
      relativeDirection = -1;
 
 blade.transform.position = Vector3.Lerp(blade.transform.position, blade.transform.position + movementAxis * relativeDirection, Time.deltaTime * horizontalToolBladeSpeed);}
Answer by vegan_crocodile · Feb 09, 2021 at 03:37 PM
Update function on the mobile devices is slower than editor's Update. Try bigger numbers for speed
I believe that using Time.deltaTime inhibits such differences due to frame rates variation of different devices.
Unfortunately it doesn't. Trying bigger number was worked for me
Answer by RodrigoAbreu · Feb 09, 2021 at 03:55 PM
You are using the t of the Lerp wrongly. Try something like this:
 float elapsedTime;
 float lerpDuration;
 
 void Update()
 {
     newDir = new Vector3(joystickDirection.x, movementAxis.y, joystickDirection.y);    
     angle = Vector3.Dot(movementAxis, newDir);
     
     if (angle > 0)
     {
         relativeDirection = 1;
     }
     else
     {
         relativeDirection = -1;
     }
     
     if (elapsedTime < lerpDuration)
     {
         valueToLerp = Vector3.Lerp(blae.transform.position, blade.transform.position + movementAxis * relativeDirection, elapsedTime / lerpDuration);
         elapsedTime += Time.deltaTime;
     }
 }
Your answer
 
 
             Follow this Question
Related Questions
Can't build for either iOS or Android: Failed to copy/move file 0 Answers
Win32Exception for Android signed build on Unity 2017.3.1 Mac 3 Answers
Android Build 0 Answers
Will Admob work for iOS? 1 Answer
Building to IOS 2 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                