Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lerp Movement on Circle Spline
#1
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.


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.
Reply
#2
Did you tried to use Time.smoothDeltatime in there?
Reply
#3
(09-28-2015, 07:27 AM)Jake Wrote: Did you tried to use Time.smoothDeltatime in there?


In my case, this doesn't seem to be working out. There must be a way of when I press the screen, the paddle I use on the spline lerps from it's current speed to it's maximum speed but for the life of me I can't think of it =[.
Reply
#4
Hm, guess you'll have to give a bit more insight about the setup then.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  player stuck on spline Dextex 4 104 07-17-2021, 04:52 PM
Last Post: _Aka_
  Locking the UV's of a closed spline John_MLS 1 113 07-09-2021, 03:54 PM
Last Post: _Aka_
  Accessing generator's input spline in script, changing it at runtime smackledorf 3 296 06-17-2021, 01:59 PM
Last Post: _Aka_
  Questions about Generator: mesh/objects within spline, snap to control point dartboard 5 467 06-09-2021, 12:42 PM
Last Post: _Aka_

Forum Jump: