I was having a problem using Vector3.Lerp in update because the blocks I was moving would get near each other but slow down and take a long time to finish its Lerp. After reading some I found that this is a feature of Lerp and I didn't want this slowing down. I found an example on how to do it the way I needed and it works but now I can't seem to get it to move smoothly. I collide the 2 blocks and they Lerp super fast to their new spots.
void MoveObject ()
{
float i = 0.0f;
float rate = 1.0f;
while (i < 1.0)
{
i += Time.deltaTime * rate;
myTransform.position = Vector3.Lerp(myTransform.position, collisionBlock, i);
otherTransform.position = Vector3.Lerp(otherTransform.position, draggedBlock, i);
}
}
Can some take a look at this and give me a tip on what I am doing wrong?