Questions tagged [lerp]

Short for "linear interpolation".

Filter by
Sorted by
Tagged with
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
0answers
23 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: ...
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: ...
0
votes
1answer
77 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
64 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 ...
0
votes
0answers
26 views

get the value of lerp at the mouse position?

I want to get the value t (value of lerp ()) between two lines and the position of the mouse and draw a gray line that goes from line a to line b. what is the value of lerp at the mouse position?
0
votes
1answer
33 views

Why does my object rotate too fast?

...
0
votes
1answer
184 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
0answers
14 views

Unity Lerping & Following Camera is too slow

I'm using this script to follow a game object in 2D : ...
0
votes
1answer
75 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 ...
1
vote
2answers
60 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 ...
0
votes
0answers
30 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: ...
0
votes
1answer
87 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 ...
1
vote
1answer
192 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 ...
0
votes
1answer
98 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. ...
2
votes
1answer
391 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 ...
0
votes
2answers
74 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'...
1
vote
1answer
554 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
votes
1answer
43 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 ? ...
0
votes
1answer
173 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
1answer
683 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
203 views

Does CharacterController benefit from adding lerp?

Does CharacterController benefit from adding lerp? as in this script. ...
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
1answer
2k 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 ...
1
vote
2answers
260 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 ...
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 ...
0
votes
1answer
242 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 ...
0
votes
1answer
1k 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, ...
0
votes
3answers
160 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
1answer
101 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: ...
0
votes
1answer
161 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 ...
0
votes
2answers
874 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
2answers
329 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 ...
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: ...
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 (...
0
votes
1answer
23 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 ...
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: ...
-1
votes
1answer
3k 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 ...
3
votes
1answer
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 ...
0
votes
2answers
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 ...
-1
votes
1answer
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 ...
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
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'...
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 ...
0
votes
2answers
210 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]);
1
vote
4answers
944 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, ...
0
votes
1answer
915 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 ...
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
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 ...
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 ...