Questions tagged [lerp]

Short for "linear interpolation".

Filter by
Sorted by
Tagged with
2 votes
1 answer
62 views

Consistently moving a GameObject from Point A to Point B using Unity Visual Scripting

I built a subGraph in Unity Visual Scripting to move a GameObject ("returnThisGameObject") from its current location (Point A) to its originalPosition (Point B). The code run dozen of times ...
  • 351
1 vote
2 answers
115 views

How to create a camera that combines both forced movement and smooth player following

Context So I'm making a clone of Crossy Roads where the camera follows the player. It does some linear interpolation (Lerp) after moving, and the camera starts moving away from the player in the ...
-1 votes
2 answers
326 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. ...
  • 1
0 votes
1 answer
321 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 ...
  • 33
0 votes
1 answer
219 views

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

Here is the code I am using: ...
  • 11
0 votes
0 answers
244 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: ...
0 votes
0 answers
138 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: ...
  • 47
0 votes
1 answer
254 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 ...
  • 3
0 votes
1 answer
555 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
1 answer
227 views

Why does my object rotate too fast?

...
0 votes
1 answer
661 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, ...
  • 561
0 votes
1 answer
248 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
2 answers
223 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
0 answers
52 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: ...
  • 163
0 votes
1 answer
260 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
1 answer
338 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 ...
  • 105
0 votes
1 answer
432 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. ...
  • 1
2 votes
1 answer
445 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
2 answers
182 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'...
  • 194
1 vote
1 answer
1k 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
1 answer
202 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 ? ...
  • 537
0 votes
1 answer
243 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. ...
  • 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 ...
0 votes
1 answer
329 views

Does CharacterController benefit from adding lerp?

Does CharacterController benefit from adding lerp? as in this script. ...
0 votes
1 answer
44 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
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
536 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 ...
  • 849
0 votes
2 answers
95 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
1 answer
339 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
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, ...
0 votes
3 answers
224 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 ...
  • 102
0 votes
1 answer
262 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: ...
  • 287
0 votes
1 answer
170 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
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 ...
  • 101
0 votes
2 answers
423 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
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: ...
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 (...
  • 619
0 votes
1 answer
26 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
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: ...
  • 5,296
-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 ...
  • 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 ...
  • 5,296
0 votes
2 answers
7k 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
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 ...
1 vote
1 answer
90 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
1 answer
41 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
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 ...
  • 21
0 votes
2 answers
268 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
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, ...
  • 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 ...
  • 103
1 vote
4 answers
28k 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: ...
  • 85