Im trying to move a gameobject upwards, but when i test the script it moves downwards.

This is part of my script since the entire thing is really long.

Take note that the variable currentRecoil adds 0.25 to it 4 times a second.

What im trying to do it every 0.25 seconds have the gameobject move 0.25 upwards.

Am i using the correct lerp? Should i be using Slerp or something? Im new to lerping.

Lerp simply gives you a new Vector that is a mix of the two provided Vectors. The amount of influence each vector has is determined by your third parameter. Its important to know that Lerp provides the same exact result when given the same input. This means that moving objects at a constant speed is going to require extra work for your third (called T) parameter.

Lets assume *var A = Vector3.Lerp(new Vector3(0, 0, 0)* and *var B = new Vector3(-10, 10, 0), 0)*

- If you used Vector3.Lerp(A, B, 0.0) you would get a vector equal to A
- If you used Vector3.Lerp(A, B, 1.0) you would get a vector equal to B
- If you used Vector3.Lerp(A, B, 0.5) you would get (-5, 5, 0)
- If you used Vector3.Lerp(A, B, 0.25) you would get (-2.5, 2.5, 0)

Also, it seems like you’re always going to call it with 0.25 as your T value. Unless you want the object to slow down as it gets closer to your target, you probably don’t want that. Getting a constant speed of movement requires using an increasing/decreasing T value.