EDIT: Found some good info on YouTube. Maybe I jumped the gun on making this thread.
(I certainly regret not taking more math classes in college. Of course I’ve been doing a little reading on trig but I wanted to see if the fine folks here could help clue me in on a specific issue. Preemptive apology about all the text, too.)
Like the title says, I’m trying to understand in visual terms how Mathf.Sin and co. work to move gameobjects so that I can make use of them in a variety of ways. I got an enemy easing in/out thanks to to How to Lerp like a pro | Chico Unity3D, but I don’t really understand why it works, and I’d like to get a better understanding preferably with pictures indicating how each variable affects the movement.
I tried to cut the code down to just the important elements.
float lerpFull = 3f;
float currentLerpTime;
void Update ()
currentLerpTime += Time.deltaTime;
float lerpFraction = currentLerpTime / lerpFull;
float sinerp = Mathf.Sin(lerpFraction * Mathf.PI);
transform.position = Vector3.Lerp(start.position, stop.position, sinerp);
My understanding of Lerp is like this: lerpFull acts as the “100%” point of the movement (number of seconds to completion?) and acts as a constant speed, larger nums slower (taking longer to “reach” or “fill-up” percentage wise) or smaller nums faster (the opposite).
currentLerpTime snags and adds up the (constant?) time since the previous frame happened (like 0.0002+0.0002+etc.). lerpFraction gets the current fraction/decimal of the “100%”.
transform.position = Vector3.Lerp(start.position, stop.position, lerpFraction) works as a straight, constant point-to-point, adding up the time until the “final time”/100% is reached and movement stops).
Course I’m really wondering about sinerp = Mathf.Sin(lerpFraction * Mathf.PI); It seems to adjust the movement to that of a Sine wave (or half a sine wave/half circle), except in this case there’s no circular movement, just straight point-to-point.
Is Mathf.Sin getting the Opposite length of the triangle each frame, and factoring in the lerpFraction percentage? How does .Sin sort of “keep track” of how much to ease in and ease out at which lerpFraction percentage (or should I just accept that “it just does”)? Is Math.PI necessary for Mathf.Sin to “think” the gameobject is moving on a circle (thus have the different lengths that the “spokes” of a circle can provide, like I’ve tried to show in the image below)?
Anything right here in this image?
Also, sorry for the weird way of trying to understand this. It’s probably confusing in its own right.
In trying to more fully understand trig for other enemies, I’m wondering, could I apply Sin or another Mathf trig function to have an enemy jump/“bounce” along (jump in a sine wave motion (half-circle), then go again once it contacts the ground)? I assume I’d get the Mathf.Sin info but instead of Vector3.Lerp I’d want a different function(s). Or perhaps I should stick with AddForce for something like this?
Thanks in advance anyone who read my bigass wall of text and tries to assist me.
I’ll definitely continue to read about geometry/trig in the context of games, but I felt the need to get this curiosity out of my system.

