Questions tagged [lerp]

Short for "linear interpolation".

Filter by
Sorted by
Tagged with
1 vote
1 answer
298 views

Godot Velocity: Invalid type in utility function "lerp", cannot convert arg 2 from Vector2 to float on line 40

I'm trying to solve a lerp problem on my velocity, searched some stuff here and there, but found nothing that solved it. Can you help me? ...
Murilo Melo's user avatar
0 votes
1 answer
129 views

How do tween librarys in Unity update tweens?

I am trying create a small lerp helper script that basically allows me to do something like a small tween with a extension or static method (So I can call it from my other scripts easily like you can ...
Ivan's user avatar
  • 307
0 votes
1 answer
1k views

Invalid type in utility function 'lerp'. Cannot convert argument 2 from float to Nil

Here's a declaration of Vector2 camera_input. And, it comes out to be invalid. I'm using Godot 4.0.1. Code: ...
Tyler Chen's user avatar
2 votes
1 answer
181 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 ...
kanamekun's user avatar
  • 369
1 vote
2 answers
176 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 ...
Zeid Tisnes's user avatar
-1 votes
2 answers
511 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. ...
JJVS's user avatar
  • 1
0 votes
1 answer
479 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 ...
Cato's user avatar
  • 33
0 votes
1 answer
384 views

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

Here is the code I am using: ...
Daniel Lip's user avatar
  • 1,727
0 votes
0 answers
310 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: ...
newShaderBIZ's user avatar
0 votes
0 answers
188 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: ...
yunum's user avatar
  • 47
0 votes
1 answer
329 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 ...
Ekkaia's user avatar
  • 3
0 votes
1 answer
792 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 ...
Liisjak's user avatar
0 votes
1 answer
343 views

Why does my object rotate too fast?

...
Daniel Lip's user avatar
  • 1,727
0 votes
1 answer
915 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, ...
caleidon's user avatar
  • 561
0 votes
1 answer
379 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 ...
AdolfJames Urian's user avatar
0 votes
2 answers
299 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 ...
MKorialstrasz Krasus's user avatar
0 votes
0 answers
69 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: ...
stackers's user avatar
  • 163
0 votes
1 answer
351 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 ...
verified_tinker's user avatar
1 vote
1 answer
431 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 ...
Evan Ward's user avatar
  • 105
0 votes
1 answer
555 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. ...
Billy's user avatar
  • 1
2 votes
1 answer
541 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 ...
Yves Calaci's user avatar
0 votes
2 answers
223 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'...
Hasen's user avatar
  • 194
2 votes
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 ...
Aaron Franke's user avatar
-1 votes
1 answer
262 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 ? ...
user43474's user avatar
  • 537
0 votes
1 answer
251 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. ...
ClaudioA's 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 ...
hatinacat2000's user avatar
0 votes
1 answer
368 views

Does CharacterController benefit from adding lerp?

Does CharacterController benefit from adding lerp? as in this script. ...
TeachMeEverything's user avatar
0 votes
1 answer
59 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? ...
TeachMeEverything's user avatar
0 votes
1 answer
4k 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
675 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 ...
tmighty's user avatar
  • 899
0 votes
2 answers
102 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 ...
Dup Dup's user avatar
0 votes
1 answer
384 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 ...
Dup Dup's 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, ...
user3781883's user avatar
0 votes
3 answers
263 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 ...
Safa's user avatar
  • 102
0 votes
1 answer
384 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: ...
shell's user avatar
  • 287
0 votes
1 answer
183 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 ...
Random generalist's 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 ...
Ari's user avatar
  • 101
0 votes
2 answers
473 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 ...
ThatCob's 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: ...
Vlad Ilisan's user avatar
14 votes
4 answers
8k 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 (...
AzulShiva's user avatar
  • 669
0 votes
1 answer
29 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 ...
James Black's 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: ...
Evorlor's user avatar
  • 5,775
-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 ...
S. Neut's user avatar
  • 105
3 votes
1 answer
2k 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 ...
Evorlor's user avatar
  • 5,775
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 ...
rasel raaz's user avatar
-1 votes
1 answer
2k 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 ...
alexo1001's user avatar
1 vote
1 answer
93 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. ...
Kevin Griffiths's user avatar
1 vote
1 answer
45 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'...
Gabriel_ES's 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 ...
Matt's user avatar
  • 21
0 votes
2 answers
289 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]);
user6111204's user avatar