# Tagged Questions

Short for "linear interpolation".

3k views

### How do I lerp between values that loop (such as hue or rotation)?

View Demo I'm trying to make the joint rotate smoothly around the center of the canvas, toward the angle of mouse pointer. What I have works, but I want it to animate the shortest distance possible ...
4k views

### How to Color.Lerp between multiple colors?

I have found it rather difficult to find a solution to this in the Unity documents. Color.Lerp(Color a, Color b, float t) is a function that gradually changes a color according to a step t, giving it ...
1k views

### How does interpolation actually work to smooth out an object's movement?

I've asked a few similar questions over the past 8 months or so with no real joy, so I am going make the question more general. I have an Android game which is OpenGL ES 2.0. within it I have the ...
169 views

### Unity's Quaternion.Lerp slows down when target is directly behind turret

Software: Unity v5.2.1f1 Personal I am trying to achieve the effect of a turret in Unity. For this I have a turret consisting of 3 parts as well as a target. The problem is that whenever the target ...
1k views

### How do I make an object face the mouse position, but only on one plane?

I want a game object to turn and look towards where the mouse was clicked (in world space). It works well when considering all 3 dimensions, but I really only care for the plane formed by the x and z ...
315 views

### Lerping character moving up and down slope tiles

So, when interpolating position against a standard 'horizontal' platform, everything works great. What happens is something like this..... (Question continues after graphic) Now, the question I ...
881 views

### How to smoothly change the target of smooth follow without camera glitch?

I am trying to change the target of the smooth follow at runtime, but there is a glitch in the camera since the targets are different sizes. I tried using lerp and smooth damp both gave the same ...
618 views

### What's the difference between Mathf.Lerp and Mathf.SmoothDamp

I want to smoothly go from one value to a new one (moving a slider or changing color). I tried using both functions and they all basically give the same result. What is the difference between them and ...
143 views

### Rendering after interpolating, renders inside/outside other objects

So, we're working out our interpolated render-coordinates during our render call and it's doing a fantastic job of smoothing everything out. All is great and collision detection is working to a ...
74 views

### Decelerate moving platform at targets

I'm trying to make a moving platform move at a constant speed and then when it is near the target start to slow down, I have trying to do this with Lerp, but I'm not satisfied with the results because ...
98 views

### How can I min-max quaternions?

What I'm doing In my engine, I'm trying to implement a camera that will follow a target object, such as a player. I wanted to avoid just simply using the inverse of the target's transformation, ...
90 views

### How to lerp all members of array in Unity 5?

I've an array of gameobjects called cards and I have this code to run when clicking a button public void mover() { for (int x = 0; x < cards.Lengh; x++) { cards[x].transform.position = ...
173 views

### Straighter SLERP/LERP

I am debugging my Lerping to see how it works. It is rotating a card and it looks good. However the lerping contains way beyind the card is visually done rotating. I understand it has to do with the ...
619 views

### Spot Light color fade in Unity 3d

I have a scene where many spot lights are focused on the screen. All have red color and same intensity. What I want is that the red Color(0,0,0,1) value should increase and decrease in a fading effect ...
802 views

I don't understand the lerp example in this code : if(dot(WorldNormalVector(IN, o.Normal), _SnowDirection.xyz)>=lerp(1,-1,_Snow)) o.Albedo = _SnowColor.rgb; else (...
40 views

### Creating Slide-In Text [duplicate]

I want to make my text slide like so: This is from the game "Crossy Road". The movement is normally smoother that in the .GIF Here are some more frames from the GIF to make you understand what I ...
79 views

### Entity Interpolation (Lost Packets?)

I'm working on a networked game for a while. I'm aware of client-side prediction and lag compensation (shooting) but I'm not sure about entity interpolation client-side. I'm sending update/sync ...
187 views

### Smooth player movement in a tile map based engine

The character is moving too much fast, it teleports! Note that a tile is 80x80. Each cell has 4 bools to say if you can go up, down, right, left. Am I doing something wrong with Lerp? This is the ...
73 views

### How does Color.Lerp works?

I want to understand how does Color.Lerp works in unity. According to this page it is quite clear to understand how to use it but I'm interested in how it is implemented. Does it work on RGB channels? ...
186 views

### Make object follow another object while keeping the same distance from it

I want an object to follow another object just like the way it follows it when it's parented to it, but smoothly and only in the x and z axis. Here's my code so far: distanceX = player.position.x - ...
2k views

### Lerp problem object teleporting not moving

Hi i just wanna move my object smoothly from one position to another but object disappear and immediately teleport to position where i clicking anyone know whats happen ? if (Input.GetKeyDown(...
285 views

### Unity3d - Transform rotation(angle) help

Im trying to rotate an object 90 degrees to the left but instead of rotating straight left it rotates 270 degrees to the right. Here's the part of the code which controls the rotation: ...
4k views

### Quaternion Lerp never reaches target

I seem to have misunderstood something about how LERP works. Im not sure what is missing. The object is rotating as it should, but it cant seem to get it to end. The transform.rotation dont seem to ...
35 views

### Lerp velocity in specific time

How to lerp velocity to 0 in specific time? For example in two seconds? I need this for jumping. velocity.Y = MathHelper.Lerp(velocity.Y, 0, [time]);
117 views

### Lerp vs. Animation

I've read a few posts regarding lerp and animation, but none seemingly fully answer my question - or I'm not reading into them correctly. Lets say I have a box in a game. This box has a lid, and the ...
114 views

### Stop Lerp at relative location?

In my Unity 2D platformer, I'm trying to move the camera down a bit when the character is crouching but not moving. I've done this with the following: cameraPosition = mainCamera.transform.position.y;...
399 views

### Lerp an object based on timers

I'm trying to make a target lerp between two objects based on a timer. At the moment, I have the following code: float distCovered = (Time.time - waitTime) * speed; float fracJourney = ...
22 views

### (3D) Parabola jump with given start and end

I have a start point and and endpoint given. I'd like to lerp the position from start to end via parabola i.e. over an arch. -(x-x0)(x-x1) won't work if one of the points isn't zero. Someone has a ...
59 views

### Use Lerp Position and Slerp Rotation together

This is what I try to do, When I click on a UI Element, the camera smoothly rotate (to look at the target) and simultaneously move on top of the target. To perform that I use a two Coroutine one for ...
445 views

### Lerping back and forth in Coroutine [closed]

Im trying to lerp the scale of a game objecto to 30% its size and then back again, but all i get as output is " Blippping Cursor up scale 0 down scale 0 IEnumerator Blip_cr (...
153 views

### Quaternion.Lerp not working properly in Unity3d

I'm using Quaternion.Lerp to rotate a joint with a certain angle, but when I use the below code I find the joint rotating very far although I specified it to rotate with only 5. Any thoughts please? ...