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
  Method of scattering objects along spline joebain 1 3 11-26-2024, 03:20 PM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 5 13 10-29-2024, 10:19 AM
Last Post: _Aka_
  Nested Spline Volume Spot Instantiation merobbins5 3 7 07-26-2024, 09:58 AM
Last Post: _Aka_
  Left-right movement, and spline follow shihaya 3 10 07-12-2024, 12:50 PM
Last Post: _Aka_

Forum Jump: