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
0
votes
1 answer

(Unity2D) Switch movement style on collision

I have a player character in a topdown game that moves in grid-like movements (1 unit at a time), but when it hits a patch of ice (square), I want it to switch to lerp-movement, slide to the edge, and stop. Currently I have 5 different colliders as…
0
votes
1 answer

I want an Object lerping in the y-axis to move along the Z-Axis?

I'm currently making a runner type game that is not randomly generated in Unity. The player, camera and background stay in the same place (the player movement is clamped) and the hazards come towards the player along the negative Z-Axis with this…
bonishadelnorte
  • 75
  • 1
  • 1
  • 7
0
votes
1 answer

Trying to create function that interpolates a float to zero

I am trying to create a smooth function to interpolate a number to zero. Problem is, it isn't working. In this case, if I increase a number by 0.01 a specified number of times, I want to decrease that number by 0.02 until it is zero. Here is my…
user7323126
0
votes
1 answer

How can I get my camera to momentarily pause between different positions when using lerp in Unity3D?

I have an array of positions that I want my camera to move/lerp between. There are two buttons (button A and button B) that trigger the camera to move position. If the user presses button A, the camera will lerp to the previous position in the…
BobSacamano
  • 157
  • 1
  • 8
0
votes
3 answers

Quaternion lerp with different velocities for yaw/pitch/roll

I want to lerp between two rotations with different velocities on three different axis (yaw/pitch/roll) in unity3d, and tried to achieve that with Quaternion.LookRotation(). Quaternion.LookRotation() takes a direction Vector as first parameter, so i…
sonority
  • 1
  • 4
0
votes
0 answers

Move SKCameraNode using LERP through SKConstraint

I was just wondering if there is a way to implement a linear interpolation effect on my SKCameraNode while it is following my player node through use of SKConstraints. I am currently using constraints identical to the constraints used in Apple's…
nikv
  • 11
  • 3
0
votes
0 answers

Unity Smooth Rotation and Scale

Below is part of my collision script, everything is working fine with it. I am trying to figure out how to make "player" do a smooth rotation and shrink the scale of the player object. How would I go about this? Should I create a check variable and…
shane
  • 342
  • 1
  • 5
  • 28
0
votes
1 answer

Lerp not consistently smooth for car movement

I am simulating cars driving through a road network given four columns of data time, id, x and z where a car with id id is located at x,0,z at time t Here is a sample: t id x …
rafvasq
  • 1,512
  • 3
  • 18
  • 48
0
votes
1 answer

How can i set a variable to 0 gradually in p5.js (javascript)?

I'm trying to control an ellipse with the up,down,left,right keys. I want to make it smooth, so the ellipse doesn't stop immediately. Also when its moving to the left and you press the right arrow, it turns around faster. Minimal, Complete, and…
hodabi
  • 1
  • 1
0
votes
1 answer

Scaling up an object and moving it into position at the same time in Unity

I am creating a feature that when the user clicks on a child of an object the parent scales up a certain ratio and the parent moves so that the child component is at a center point. I have all of that working just fine. Currently, I am performing…
Dtb49
  • 1,211
  • 2
  • 19
  • 48
0
votes
0 answers

Rotation while lerping looks wrong

I have a function that lerps an object in front of the camera to "pickup/hold" said object. However, while holding the object, if I hit it against another object a certain way, the held object will rotate in an unexpected way. I am not changing the…
0
votes
1 answer

Lerping between two colors

I'm trying to transition between two colors, black to blue over a 1 second period but I can't seem to get it right. Currently when I click the button the color stays black and never transitions to blue. What do I need to fix? Thank you! private…
greyBow
  • 1,298
  • 3
  • 28
  • 62
0
votes
1 answer

Why does this DirectX 10 "D3DXVec3Lerp" function return invalid numbers?

I'm having trouble with the following code: //Make life easier by assigning the last two relevant messages to variables Update pos0 = m_Network->positionUpdates[m_Network->positionUpdates.size() - 1]; Update pos1 =…
0
votes
0 answers

Coroutine Lerp not functioning correctly?

There are two parts to this problem - the first being that a nested for loop is run to separate the children of an parent game object via their collision boundaries (collider.bounds). If there is a collision (boundaries intersect) the intersecting…
jtth
  • 876
  • 1
  • 12
  • 40
0
votes
0 answers

Java - Objects won't go off screen (top- & leftside only)

I am trying to "teleport" objects to the opposite positions whenever they get out of screen. I've managed to do this with right & bottom sides, but for some reason, which I haven't figured out, the star objects won't go off screen on TOP & LEFT…
Feelsbadman
  • 1,163
  • 4
  • 17
  • 37