I’m creating a game with unity 5 in 2d, and tried to create a script for the camera to follow the character by moving the camera transform.
For this I followed some tutorials on youtube but when I was compiling the code indicated in the Lerp method, I tried to adjust the code in several ways and I did not get a solution, which I send here and the last version of the code that I have changed infinitely many times.
As the error message indicates, your call to the Lerp method expects parameters other than those you passed on. It expects two
b ) and
t ), because what this method does is interpolate between two vectors
b in a
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
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
Q.: You should also make the last line be
MCamera.position =instead of
MCamera.position.x = vetor.