Lerp glitchiness?

I’m having a problem…

I’m moving an object to various predefined coordinates. The coordinates contain angle and position (stored as floats). I’m moving the object to a new coordinate each second, and I’m using the time fractions to move it between those points using Vector3.Lerp and Quanternion.Lerp. It works and for the most part looks OK, but it appears to be doing a bit of a random glitchiness about it’s movement. Sometimes it’s fine and then others it appears to bounce for just a single frame by about 10% of the motion distance. I’m wanting to blame Lerp for this right now. All of the movements are calculated and moved in the update routine.

Any thoughts why I might be getting glitchy movement?

All Lerp does is this: Given

Lerp (from, to, t)

it computes (after clamping t between 0 and 1)

(to - from) * t + from

It’s extremely basic math, not magic, and there are no glitches. The problem is somewhere in your code.

–Eric

You’re correct. I was using Mathf.Round as part my formula to get the decimal, I didn’t know it rounds to the nearest even number which may be up or may be down…weird behavior IMO. I just used an Int instead and it fixed it. Thanks for the reply.