As the error message indicates, your method call Lerp expects different parameters from the ones you passed. It expects two Vector3
(a
and b
) and a float
(t
), because what this method does is interpolate between two vectors a
and b
at a time t
.
You are passing the first parameter, for example, MCamera.position.x
, which is the component x
(a value float
) vector position
. You should probably come by MCamera.position
directly (and the same goes for the parameter transform.position.x
, that should be just transform.position
).
If your interest is to interpolate only the value of x
even, experiemente with Vector3(transform.position.x, 0, 0)
(creates a new vector with only its value x
, and with the value 0
for the components y
and z
).
P.S.: You should also make the last line be MCamera.position =
vetor
instead of MCamera.position.x = vetor
.
Hello. Welcome to SOPT. First of all, there is a tip for other questions in the future: do not post images with screenshots of your code. Post the code in textual form (properly formatted automatically by the system)! So anyone interested can just copy a snippet without having to type it all in manually.
– Luiz Vieira