Questions tagged [lerp]

Lerp is a function which Interpolates between two values in a specific time `t` to create smooth animations.

Linearly interpolates between two vectors.

Interpolates between a and b by t. t is clamped between 0 and 1. It is used to create smooth changes of all type of ui controls. Changing the Audio, a Color or transform values of an game object in unity3d can be done with Lerp easily.

Documentation

170 questions
1
vote
0 answers

Using individual timestep's position data to Lerp transform positions?

I have a large dataset that contains the position data for a vehicle at 0.1 second intervals and I have been trying to take this data and animate a gameobject smoothly along these positions. I have tried Using AnimationCurves and adding keyframes…
1
vote
1 answer

How to properly implement multiple Vector3.Lerps in series?

I'm attempting to grow and then shrink a series of gameobjects using two different lerps within a coroutine. Despite the two while loops being functionally identical, the objects will grow but not shrink afterwards, instead remaining at their…
Dean
  • 11
  • 2
1
vote
1 answer

Why the lerp function not working for the instantiated randomized Gameobjects?

The code helps in moving the game object in a continousy loop. I want the randomized generated cubes to follow the same pattern too. I didn't add the condition for stopping the generation of game objects when it completes one round. Currently, the…
1
vote
1 answer

How would you lerp the positions of two matrices?

In my code, I create 2 matrices that store information about two different meshes, using the following code: Mesh mesh; MeshFilter filter; public SphereMesh SphereMesh; public CubeMesh CubeMesh; public Material pointMaterial; public Mesh…
m0a
  • 1,005
  • 2
  • 15
  • 29
1
vote
1 answer

Unity fill amount lerp returning wrong value

Trying to lerp the fill amount of a health bar. Have this code: public float lerpSpeed = 2; public void FillBar() { bar.fillAmount = Mathf.Lerp(0f, 0.7f, Time.deltaTime * lerpSpeed); Debug.Log(emotion.fillAmount); } When the function…
Bruno Pigatto
  • 67
  • 2
  • 13
1
vote
2 answers

Move Inside Pipe Like F-Zero GX

I've been working on this project for a while - I've been trying to get a simple cube that the player can move left or right with the arrows the ability to rotate around a pipe, similar to how racers can move around a pipe in F-Zero…
1
vote
1 answer

Change lerp values smoothly over time

I am currently working on a dynamic skybox. My skybox is composed of 3 separate scripts: CustomList ,CustomListEditor., TOD.CS CustomList.cs has class that stores variables for what each variable will be at a specific time. Example: time, cloud…
1
vote
1 answer

Run lerp over timer

First off, I am not using any kind of game engine, I am modding a game in C# and I am NOT using UnityEngine API so I do not have any Update() functions. So I am trying to figure out how I could create a timer, some standard out of the box C# timer…
KevinM1990112qwq
  • 715
  • 2
  • 10
  • 23
1
vote
1 answer

Unity Rotate Player while in free fall Not Working

I have a player that launches off a ramp. Everything works fine until that point. When the player is off the ramp they are looking a little upwards so what I am trying to do is smoothly change the player (X, Y, Z) rotation; from the current one to…
shane
  • 342
  • 1
  • 5
  • 28
1
vote
1 answer

Smooth move camera position according to array of cameras

I'm currently trying to smoothly change the camera's position using a pre-defined array of camera positions. It should go like this: I press space, and the camera should smoothly change to the position of camera 0 in the camera array. I press space…
Thrindil
  • 143
  • 3
  • 17
1
vote
0 answers

Shape interpolation with quaternios using Eigen in C++/OpenGL

I am trying to implement shape interpolation between two triangles using quaternions as discussed in the 2000 paper As-rigid-as-possible shape interpolation by Alexa, Cohen-Or, and Levin. Let's say Triangle 1 has points A, B, C, and Triangle 2 has…
Toj19
  • 129
  • 1
  • 2
  • 9
1
vote
2 answers

Change movement speed in Vector.Lerp Unity 5.6

I am using Vector3.Lerp in unity game to simply move a gameobject from one position to other smoothly. Below is my code: public class playermovement : MonoBehaviour { public float timeTakenDuringLerp = 2f; private bool _isLerping; …
Digi Art
  • 13
  • 1
  • 4
1
vote
0 answers

How to generalize linear interpolation between two numbers into higher dimension tensors?

Linear interpolation between two values is rather simple: def lerp(v, d): return v[0] * (1 - d) + v[1] * d print lerp(np.array([3, 5]), 0.75) > 4.5 Let generalize it to arbitrary tensors of shape (2, 2, …), i.e.: def lerp(v, d): assert…
jaboja
  • 2,178
  • 1
  • 21
  • 35
1
vote
4 answers

How to Lerp between two quaternions?

I have two quaternions: SCNVector4(x: -0.554488897, y: -0.602368534, z: 0.57419008, w: 2.0878818) SCNVector4(x: 0.55016619, y: 0.604441643, z: -0.576166153, w: 4.18851328) and if we create two objects the orientation will be quite similar but if…
1
vote
2 answers

Unity lerp remove gaps

I'm currently instantiating some objects in a row using Vector3.Lerp. This is working, however it's also creating some gaps between the objects. This happens if the distance between the start and end isn't big enough to insert a new object, but…
Tony
  • 3,587
  • 8
  • 44
  • 77