09-27-2015, 08:22 PM
Hello.
I'd like to know if I can Lerp the movement of my game object on a circular spline? On my web and machine builds - the movement is smoother than on my Android device. I am lead to believe this has something to do with the way Unity handles the inputs on mobile devices compared to desktops (but I could be wrong).
I am using a fairly old version as it is for a fairly old game (but I do not want to update the package because of the change I have made to the scripts etc.). However, I am sure that the movement code can be changed to allow this to happen but I am unsure as to which part of the script I need to change.
Below is the code that was in the script when I started using it. I have only changed the script elsewhere to work with my touch input. I am using movement by world units.
Thanks.
I'd like to know if I can Lerp the movement of my game object on a circular spline? On my web and machine builds - the movement is smoother than on my Android device. I am lead to believe this has something to do with the way Unity handles the inputs on mobile devices compared to desktops (but I could be wrong).
I am using a fairly old version as it is for a fairly old game (but I do not want to update the package because of the change I have made to the scripts etc.). However, I am sure that the movement code can be changed to allow this to happen but I am unsure as to which part of the script I need to change.
Below is the code that was in the script when I started using it. I have only changed the script elsewhere to work with my touch input. I am using movement by world units.
Code:
if (MoveByWorldUnits) {
// either used cached values(slightly faster) or interpolate position now (more exact)
// Note that we pass mTF and mDir by reference. These values will be changed by the Move methods
mTransform.position = (FastInterpolation) ?
Spline.MoveByFast(ref mTF, ref dir, Speed * Time.deltaTime, Clamping) : // linear interpolate cached values
Spline.MoveBy(ref mTF, ref dir, Speed * Time.deltaTime, Clamping); // interpolate now
}
else { // Move at constant F
// either used cached values(slightly faster) or interpolate position now (more exact)
// Note that we pass mTF and mDir by reference. These values will be changed by the Move methods
mTransform.position = (FastInterpolation) ?
Spline.MoveFast(ref mTF, ref dir, Speed * Time.deltaTime, Clamping) : // linear interpolate cached values
Spline.Move(ref mTF, ref dir, Speed * Time.deltaTime, Clamping); // interpolate now
}
Thanks.