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
1 answer

Why Are My Image Positions Lerping At Two Different Speeds?

I've got some simple code here. The issue I am having is that the images contract to the center (local position Vector3.zero) at what seems to be nearly double the speed as they move away from the center. I believe I am using them same logic to move…
Relu
  • 37
  • 5
0
votes
0 answers

Linear interpolation: reach moving destination regardless how fast it moves

I'm implementing a camera for a game and I'm using the LERP formula for smooth chasing. However, if the target moves fast enough, the camera can never reach it unless the t ((1 - t) * v0 + t * v1) value is high enough, but that is exactly the…
Yves Calaci
  • 1,019
  • 1
  • 11
  • 37
0
votes
1 answer

Consistent delay in lerp

I have a script that instantiates a prefab when a projectile first enters a collider, and then increases the scale of that prefab for each of the next four projectiles that enter the collider using Lerps. The interpolation is fine the first time…
0
votes
0 answers

Why i am getting the NullReference Error on my transform.position?

I am makin a script from moving the camera and i get this error : NullReferenceException: Object reference not set to an instance of an object but my script works, no crash or something just this error on the console, do you know why ? there is the…
skehal
  • 13
  • 4
0
votes
1 answer

Why my camera block between two position using lerp?

im trying to make a script that allow my camera moving into 4 differents position ( front back left right ) using keyArrows and lerp. the first movement works good, but when i hit another KeyArrow my camera move a little bit and get stucks between…
skehal
  • 13
  • 4
0
votes
1 answer

Unity 3d Quaternion Rotation Lerp of 3d Object

I am working on a Unity project. There is a car wiper and i want to rotate it in a way that when I pres "wipers toggle on" wipers start rotating from 0,0,0 to 0,0,-45 and start lerping. But when I press "wipers toggle off" the wipers must rotate…
0
votes
1 answer

Unity - Move (Shuffle) multiple GameObject from their current position to a new destination position

I am trying to do a shuffle functionality so I can change the order of multiple GameObjects. I have multiple "letters" (GameObjects) in a circle and when I click "Shuffle" I just need to reorder their position but showing the letter moving to it's…
Johny
  • 625
  • 2
  • 6
  • 26
0
votes
1 answer

Unity3D: Mathf Lerp too fast when timescale increases

I have an image with a fill amount component controlled by a Mathf Lerp. The problem is, the time for completion of the Mathf Lerp function decreases more than expected when the timescale increases. When the timescale is equal to 2 the function…
ClaudioA
  • 327
  • 1
  • 5
  • 20
0
votes
0 answers

Creating a color loop effect in Unity?

I'm currently developing a game in Unity and I ran into a small problem. I'm trying to generate a rainbow color effect that is similar to what happens when someone catches a star in mario kart or supermario on a specific gameobject. Essentially all…
Maurice Bekambo
  • 325
  • 6
  • 21
0
votes
2 answers

How to start Vector3.Lerp from middle point?

I have to move object from -10 to +10 x position. But I want to start my object from zero x.point to move, how can I start my lerp at the middle position? Edit2: Object should start at x = 0 position and move to +10 x position and go to -10 x…
Tolga Yavuz
  • 159
  • 2
  • 10
0
votes
2 answers

Coroutine does no play all the way through

Unfortunately my co routine does not play all the way through. It is supposed to fade an object so it's alpha is 0. However it fades to .039. { StartCoroutine(colorlerpin7()); yield return null; } public IEnumerator colorlerpin7() { …
jono
  • 35
  • 8
0
votes
1 answer

Unity trying to lerp between RenderSettings.ambientskycolor not working?

Ok Im trying to lerp through 3 states where each has a different ambient light color. One of the states needs to alpha lerp in the alpha of a different material. I have everything set up accordingly yet when I trigger the transition (using space),…
UserDude
  • 323
  • 1
  • 3
  • 18
0
votes
1 answer

Three.js: How to create a transition between two objects?

I created a tunnel out of a cylinders. When the mouse is in a corner, it removes the old cylinder and creates a new one with a different number of radial segments. But now the change between the objects is without any transition. Is there a…
Sarah
  • 15
  • 4
0
votes
1 answer

Unity Move 3D object Within a barrier

I am using the code below attached to a cylinder object with ridge body and collision. This object is placed in the middle of collision barriers that form a circle. I am trying to get this object to move smoothly forward a random distance and after…
shane
  • 342
  • 1
  • 5
  • 28
0
votes
3 answers

Remove delay between lerps

I made a simple script that goes to one waypoint and then to the next. My problem is that it seems to be a delay while going from waypoint1 to waypoint2 and i don't know why: ¿Why is that delay happening and how can i remove it? using…
FrakyDale
  • 647
  • 8
  • 22