Questions tagged [lerp]

Short for "linear interpolation".

Filter by
Sorted by
Tagged with
-1 votes
2 answers
139 views

Lerp Teleporting In Unity

I am trying to make a object move back and fourth but its teleporting instead of moving smoothly. This is my code. ...
user avatar
  • 1
0 votes
1 answer
183 views

Deceleration via Lerping

I have written some code that creates a very nice uniform angular acceleration for an object moving around a circle. It effectively uses linear interpolation but ramps the interpolant such that the ...
user avatar
  • 33
0 votes
1 answer
74 views

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

Here is the code I am using: ...
user avatar
  • 11
0 votes
0 answers
133 views

Blending / Lerping between textures in a Unity CG Shader

I can lerp between colors just fine, but lerping between textures just doesn't seem to work. What am I doing wrong? Here's my code: ...
user avatar
0 votes
0 answers
41 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: ...
user avatar
  • 45
0 votes
1 answer
178 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 ...
user avatar
  • 3
0 votes
1 answer
295 views

Snapping to z or x rotation values with Quaternion.Lerp

My player is a cube. I want to restrict/prevent its rotation around global y axis. I am doing this using Quaternior.Lerp since I do not want to completely constraint rotation around y axis, I just ...
user avatar
0 votes
1 answer
120 views

Why does my object rotate too fast?

...
user avatar
0 votes
1 answer
446 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, ...
user avatar
0 votes
1 answer
181 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 ...
user avatar
0 votes
2 answers
174 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 ...
user avatar
0 votes
0 answers
41 views

How can I add directional friction like asteroids with SPEED and DIRECTION?

I'm trying to make asteroids, and right now I'm setting the direction based on the mouse angle, like so: ...
user avatar
  • 163
0 votes
1 answer
151 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 ...
user avatar
1 vote
1 answer
283 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 ...
user avatar
  • 105
0 votes
1 answer
259 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. ...
user avatar
  • 1
2 votes
1 answer
414 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 ...
user avatar
  • 183
0 votes
2 answers
123 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'...
user avatar
  • 185
1 vote
1 answer
899 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 ...
user avatar
-1 votes
1 answer
100 views

Change scale values by Lerp?

How to change the scale values of object by using Lerp. from 0 to 0.01722f and reveals later ? ...
user avatar
  • 507
0 votes
1 answer
222 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. ...
user avatar
  • 145
0 votes
1 answer
1k 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 ...
user avatar
0 votes
1 answer
284 views

Does CharacterController benefit from adding lerp?

Does CharacterController benefit from adding lerp? as in this script. ...
user avatar
0 votes
1 answer
40 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? ...
user avatar
0 votes
1 answer
3k views

Unity3D: Replicating SM64 turning movement into Unity

Brief Summary: I want to recreate Super Mario 64 turning movement into unity without the clunky movement I currently have. And I would also love how to implement the camera rotation system mentioned ...
user avatar
1 vote
2 answers
391 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 ...
user avatar
  • 819
0 votes
2 answers
91 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 ...
user avatar
0 votes
1 answer
296 views

How do online games deal with lerp overshooting?

From what I understand, when you lerp in an online game, you travel from point a to b based on the elapsed time since the last update. The problem is when you have a higher latency, and you start ...
user avatar
0 votes
1 answer
2k views

Multiple Colour Gradient Lerp

I want to return a colour for a position t, given an arbitrary number of colour stops - a stop is comprised of a position, and a colour. Like selecting a colour from a multiple-colour gradient, ...
user avatar
0 votes
3 answers
192 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 ...
user avatar
  • 102
0 votes
1 answer
177 views

lerp vector2 to target vector2 at constant rate

I am struggling to figure out how to lerp one vector2 to a target vector2 at a constant rate. I can do it as a percentage of the total x, y distance like so: ...
user avatar
  • 287
0 votes
1 answer
169 views

Unity 2D camera behaviour

I am trying to create camera behavior where camera moving slightly forward the player along his movement direction to extend the visible area. For camera movement, I use an empty object which moves ...
user avatar
0 votes
2 answers
1k 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 ...
user avatar
  • 101
0 votes
2 answers
383 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 ...
user avatar
1 vote
1 answer
2k 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: ...
user avatar
12 votes
3 answers
7k 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 (...
user avatar
  • 619
0 votes
1 answer
25 views

Transform values stay zero while catching mouse movement

I am working on a game using GoogleVR, but I don't think that has anything to do with my problem. Basically, I am testing to see if I can move a stick by using the mouse at the moment. I am getting ...
user avatar
0 votes
1 answer
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: ...
user avatar
  • 5,315
-1 votes
1 answer
4k views

Unity 5 - Moving canvas elements smoothly

So I am making a game menu in unity 5 for a school assignment. I am trying to smoothly move an image on the canvas using lerp. The canvas is on world space render mode because I also want to make a ...
user avatar
  • 105
3 votes
1 answer
1k 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 ...
user avatar
  • 5,315
0 votes
2 answers
6k views

Parabolic movement of a gameObject in Unity

Currently I'm working on a 3D game. In this game my player is a ball and it can jump from tile to tile. The movement of the ball is 45 degrees left or right when it jumps. I want to make it jump in a ...
user avatar
-1 votes
1 answer
1k views

Smoothly moving an object sideways by a certain amount when a key is pressed Unity C#

I basically want to have the user press A once without holding it down, to smoothly move the player to the left. I would like to make the player move to the left by -12. So he would end up going from ...
user avatar
1 vote
1 answer
85 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. ...
user avatar
1 vote
1 answer
40 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'...
user avatar
2 votes
1 answer
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 ...
user avatar
  • 21
0 votes
2 answers
249 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]);
user avatar
1 vote
4 answers
1k 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, ...
user avatar
  • 1,003
0 votes
1 answer
1k 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 ...
user avatar
  • 103
1 vote
4 answers
27k 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: ...
user avatar
  • 85
1 vote
0 answers
44 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 ...
user avatar
  • 11
10 votes
2 answers
21k 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 ...
user avatar