As the error message indicates, your call to the Lerp method expects parameters other than those you passed on. It expects two Vector3
( a
and b
) and float
( t
), because what this method does is interpolate between two vectors a
and b
in a t
.
You are passing in the first parameter, for example, MCamera.position.x
, which is the x
component (a float
value) of the position
vector. You should probably pass MCamera.position
directly (and the same goes for the parameter transform.position.x
, which should be only transform.position
).
If your interest is to interpolate only the value of x
itself, experiment with Vector3(transform.position.x, 0, 0)
(create a new vector with only its value x
, and with the 0
value for the components y
and z
).
Q.: You should also make the last line be MCamera.position =
vetor
instead of MCamera.position.x = vetor
.