Questions tagged [lerp]
Short for "linear interpolation".
79
questions
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?
...
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 ...
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:
...
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 ...
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 ...
-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.
...
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 ...
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:
...
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:
...
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:
...
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 ...
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 ...
0
votes
1
answer
343
views
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, ...
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 ...
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 ...
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:
...
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 ...
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 ...
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.
...
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 ...
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'...
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 ...
-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 ?
...
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.
...
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
368
views
Does CharacterController benefit from adding lerp?
Does CharacterController benefit from adding lerp?
as in this script.
...
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?
...
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 ...
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 ...
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 ...
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 ...
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
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 ...
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:
...
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 ...
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 ...
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 ...
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:
...
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 (...
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 ...
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:
...
-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 ...
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 ...
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
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 ...
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.
...
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'...
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 ...
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]);