Questions tagged [lerp]

Lerp is a function which Interpolates between two values in a specific time `t` to create smooth animations.

Linearly interpolates between two vectors.

Interpolates between a and b by t. t is clamped between 0 and 1. It is used to create smooth changes of all type of ui controls. Changing the Audio, a Color or transform values of an game object in unity3d can be done with Lerp easily.

Documentation

170 questions
0
votes
2 answers

Mathf.Lerp Value not increasing accordingly

I would like to move an object and move it faster overtime, to be exact , increase its speed by 0.05f per second. Below is a script attach to any object that will move from Right to left then to Right again. using UnityEngine; public class…
0
votes
1 answer

Unity c#: Lerp causes positions to go crazy

I'm making a gunBob function in unity and I have a function called resetBob() that lerps the current position of the gun to the 0 position on the X and Y scale but not the Z, in order to not clash with another function. This is called in the main…
Kim
  • 13
  • 1
  • 4
0
votes
0 answers

Lerp between point on LineRenderer

Im stuck on how to lerp between points of the linerenderer which are added on runtime. It should animate in order. So IEnumerator should be used i guess. private void makeLine(Transform finalPoint) { if(lastPoints == null) { …
aokde
  • 11
  • 1
0
votes
1 answer

Unity's transform.RotateAround usage with lerp

I am working on a 3D Camera controller, where player is able to rotate the camera around an object using mouse. transform.RotateAround() is perfect for this, except for one thing - I can't figure out a way to smoothly lerp it. For reference - this…
bonanzaa
  • 1
  • 1
0
votes
0 answers

How to get array of path points or linear interpolation (lerp) on a hyperbolic plane?

The gist of it is, how do you animate between two points on a hyperbolic plane? So we have basic linear interpolation (lerp) through tweening libraries such as GSAP's TweenMax, where you can specify a start and end position and a duration, and it…
Lance
  • 75,200
  • 93
  • 289
  • 503
0
votes
1 answer

Lerping between to transforms progresses much faster than the lerp value intends

I want to make a object (fuse) fly towards another object (fuse box) and also adapt its transform.rotation values gradually. (I use transform.position/rotation = Vector3/Quarteronin.Lerp(initial.position/rotation, fuseBox.position/rotation,…
0
votes
1 answer

Linear interpolation (lerp) not working on draggable slider

I'm recently learning about "linear interpolation" & its ability to create easing. Nevertheless, the easing part of the draggable slider seem to be working... However, I can't drag the slider past the 3rd slides. There seems to be some kind of…
noirsociety
  • 314
  • 1
  • 2
  • 9
0
votes
1 answer

Vector3.Lerp() not smoothing correctly

I'm working on a hand sway system. And the problem is that when I use Vector3.Lerp(); for it, it looks really bad and laggy : https://streamable.com/64y52o And this is my source code : Transform target; float smooth; void Update() { …
0
votes
2 answers

Why is my Controller drifting with Slerp?

I've been working on this Controller, where I walk around a small planet. I'm using Quaternion.Slerp, and when I'm at certain points on the planet, the controller slowly drifts, rotating around the Y axis. My thought is that it is holding a…
BearHandz
  • 3
  • 2
0
votes
1 answer

How to slowly reduce float value using Lerp?

I'm trying to slowly reduce the value of "velocity" slowly using lerp but it doesn't seem to work for some reason. It seems to just happen instantly instead of over time. Am I doing something wrong? IEnumerator WaitCoroutine2() { yield return…
alt4s
  • 97
  • 8
0
votes
0 answers

Continuously moving ThreeJS camera slows down other animations to a crawl?

I have what I believe is a fairly common setup for a ThreeJS scene that emulates a first person shooter world. I have this block of code in my animate loop, which came from one of the ThreeJS "controls" example. I can't remember which one since…
Robert Oschler
  • 14,153
  • 18
  • 94
  • 227
0
votes
1 answer

Using Lerp Function To Make Smooth MapBox Camera Movements Using MapBox's FreeCameraApi

I'm following this tutorial tutorial for route animations. So far I did everything like it's told there. Everything works same as in the tutorial. But only problem with my animation is smoothnes of camera movements. If you go to the link and scroll…
0
votes
1 answer

How to Use Negative Values in Lerp Function as Alpha Parameter

I am trying to animate some text on the screen in two ways: Move its Y position from 1 to -1 [already finished] Shift its RGB color value from white(255,255,255) to green(149,184,6) [need help with] I am using the Linear Interpolation function…
twominds
  • 1,084
  • 5
  • 20
0
votes
1 answer

Lerp from one position to another in a specified duration with javascript

Ok so I am trying to ease a box from one place to another using Linear Interpolation. But It doesn't seem to easing it is just moving without easing. So I have read the post here C# Lerping from position to position and maybe I am misunderstanding…
user3331344
  • 728
  • 8
  • 23
0
votes
0 answers

LERP'ing with one particular animation model but only if the camera is moving freezes ThreeJS scene until LERP finished?

LERP'ing with one particular animation model but only if the camera is moving freezes ThreeJS scene until LERP finished? I have my ThreeJS running fine with 4 different animation models moving about in it. However, one of the models when it LERPs…
Robert Oschler
  • 14,153
  • 18
  • 94
  • 227