Questions tagged [lerp]

Short for "linear interpolation".

Filter by
Sorted by
Tagged with
30
votes
3answers
8k 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 ...
12
votes
6answers
28k 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 ...
12
votes
3answers
6k views

Why use Time.deltaTime in Lerping functions?

To my understanding, a Lerp function interpolates between two values (a and b) using a third value (...
11
votes
2answers
3k 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 ...
10
votes
2answers
19k 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 ...
5
votes
1answer
2k 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 ...
4
votes
1answer
822 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 ...
4
votes
3answers
773 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 have ...
3
votes
1answer
993 views

What does SlerpUnclamped do?

Unity has a Slerp method: public static Vector3 Slerp(Vector3 a, Vector3 b, float t); Where it returns an interpolated position between a and b by the percentage ...
3
votes
1answer
164 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 ...
2
votes
1answer
389 views

Linear interpolation: reach moving destination regardless its speed

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 ...
2
votes
1answer
1k views

Rotation smoothing with Slerp snaps to center when switching between different destination vectors

I'm making a 3D space shooter in Unity (think Star Fox). The ship, when I move it around the map, should rotate slightly (smoothly) in the direction I'm controlling it. I have smoothness mostly ...
2
votes
2answers
300 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 ...
2
votes
1answer
2k 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 ...
1
vote
4answers
931 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, ...
1
vote
4answers
25k 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: ...
1
vote
1answer
1k 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 ...
1
vote
2answers
254 views

Using fixed time for Lerp

I would like to change a camera's rotation and position from its current position and rotation to a destination position and rotation. This should happen within a specific time (seconds). I call ...
1
vote
1answer
217 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 ...
1
vote
1answer
177 views

Godot - Quaternion slerp is altering initial rotation of an object

I have a player that shoots a rocket. If the rocket has a target, I use a quaternion slerp to make it home in on that target. Free firing the rocket goes directly forwards as expected. Setting a ...
1
vote
1answer
1k 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 ...
1
vote
1answer
528 views

What is the use case for slerp in 2D?

When searching for slerp, I get this text: Slerp is shorthand for spherical linear interpolation, introduced by Ken Shoemake in the context of quaternion interpolation for the purpose of animating ...
1
vote
1answer
1k views

Add Lerp on only the Y axis

I want my camera to be smooth on only the Y axis.How do I do that it? Current code: ...
1
vote
1answer
1k views

"lerp" returning value (Shader)?

I don't understand the lerp example in this code : ...
1
vote
0answers
31 views

Why does Lerp not reach target if setting rb.position, but setting rb.transform.position works?

I don't understand the logic here. I have the following script which makes a player jump towards a target: ...
1
vote
2answers
56 views

How to fix issues with repeated coroutines for lerping values?

I have created a progress bar system that lerps the value over a duration to provide some life to the progress bars. I've done this using a coroutine that gets called each time a value (such as life ...
1
vote
1answer
80 views

Slow down in the same time over different distances

I'm trying to slow down a object over different distances in the same time, say 3 seconds. My slow down code is. ...
1
vote
0answers
41 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 ...
1
vote
1answer
354 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 ...
1
vote
1answer
38 views

Interpolation UNITY taking longer than expected

I'm trying to do multiplayer interpolations with the lidgren network (UDP) but the interpolation is taking longer than expected and the message queue is getting full. It's been a week and I still can'...
0
votes
1answer
782 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 ...
0
votes
2answers
322 views

What exactly is the "blend factor" t in Color.Lerp?

I had a bit of a look around and couldn't see anywhere this was addressed, my apologies if it has been. In Color.Lerp, I understand that the 3rd parameter t is not in fact the time that it takes to ...
0
votes
2answers
72 views

Java LERP but with whole pixel values

I have a formula which returns a Lerp Vector3 value in integers but the problem is it never reaches the desired target value. It'...
0
votes
3answers
158 views

Using Lerp to zoom in on an object inside an if statement

I'm trying to zoom in on an object once the raycast hits it in the Update method, I am using the Lerp method to make the camera movement smoother but it's not working properly. The object only lerps ...
0
votes
6answers
6k 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 ...
0
votes
3answers
3k 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 ? ...
0
votes
1answer
32 views

Why does my object rotate too fast?

...
0
votes
1answer
160 views

Lerp performance for camera movement

In my current script responsible for camera movement, I use Mathf.Lerp to smoothly move the camera to the desired position (with WASD movement, panning with MMB, ...
0
votes
1answer
84 views

How do I interpolate an object from point A to B such that it accelerates, overshoots, and bounces back to target position?

How The Game Works You grab and drag an object around. Once you let go, it interpolates to a certain, variable position, and that's what I'm trying to do here. Problem Description I'm talking about ...
0
votes
1answer
637 views

Unity: 'Quaternion.RotateTowards' animation is too fast (instantaneous)

I have a 'block-on-a-hinge' scenario where I just want it to smoothly rotate into the position of a stair step. I messed with this for a day and finally verified that my start and end angles are ...
0
votes
1answer
38 views

If my camera does not change position but rotates, Does adding lerp do anything?

If my camera does not change position but rotates, Does lerp do anything? ...
0
votes
2answers
862 views

Unity 2d - Vector3.Lerp Not Working as Expected

I have asked this question on other community but still get no response after a month, so I decided to ask it here. I am trying to put player position to the middle of camera when it is reaching near ...
0
votes
1answer
2k views

How can I accurately lerp Colors over seconds?

I have some code to lerp between two colors over a set number of seconds, and the lerp works fine: ...
0
votes
1answer
770 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: ...
0
votes
1answer
25 views

How can I ease in and out of a Lerp motion over a set duration?

Here is the code I am using: ...
0
votes
1answer
74 views

2D side-scroller game : smooth noise transition between biomes

I'm creating a little terraria-like 2D side-scroller game with TypeScript. Currently, I divide parts of the world into biomes, which each have their own properties (flat, mountainous terrain, etc.). I ...
0
votes
1answer
70 views

Unity - Mathf.Lerp() didn't work as expected?

I want to rotate an object 360 degrees so this is what I did: xRotation = Mathf.Lerp(0, 360, Time.fixedDeltaTime * lerpTime) and then I used Quaternion.Lerp() to ...
0
votes
1answer
90 views

Smoothly switch between 2 pairs of oscillating colors

I have a simple script that changes the emission color based on a bool. The first color is its idle color, which transitions between orange and light purple using a lerp weighted with a sine wave. ...
0
votes
1answer
172 views

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. ...
0
votes
2answers
86 views

Why does my value increase a ton when the tab switches from inactive to active?

I basically have a lerp function similar to this one: Client interpolation for 100% serverside game when a new server update is received, the update frequency is added to a variable (msAhead) and the ...