what should i use between vector3.lerp and transform.translate to move a gameobject ?

I am finding both of them to be same in the game view . so my question is , between those two at what situation i should use vector3.lerp and why


Also when will transform .translate be useful , please differentiate between these two , is there any performance issue ?if so which out of two will be good

For most practical uses it does not matter which function you use to manipulate the Transform.position. You can do += on it, you can call to Translate (which internally just calls operator +=) or you can calculate the new position by any means you like (e.g. Vector3.Lerp) and then directly set it. Doesn’t matter. Choose as you like.

If you really that uber-hard-core performance critical, then “Translate” will probably results in around 3-4 C# function calls (probably most of them inlined) plus 2 Wrapperless calls to C++. Keeping the position as C# struct cached and manipulate on that directly and only call to “Transform.position = X” is probably the fastest in terms of number of function calls (only one wrapperless C++ call).

But I challenge you to present me a game where that really matters. Before you reach these kind of performance problems, you have around 99.9% other places to look first for other issues. :wink:

TL;DR; any function will do.

vector3.lerp and vector3.movetowords these two functions are having from point and target point and the speed or time to travel.
if you want to move the target to a target position you can use the above two.

may you got dout what is the difference between vector3.lerp and vector3.movetowords.both are used to take your object to your target only but the way they send the your object is different. think like you pushed something or you roll a ball. how it is travel. it start with some speed and while on traveling ball speed gets low. like the same way if you lerp an object it start with some speed and gradually decreasing the speed on it’s way. if you use move towards it sends your target with constant speed.

now coming to transform.translate use this one if you want to transfer the object in infinity way and in certain direction.
suppose if you write
transform.translate(vector3.forward) the object goes in forward direction in infinity way.