[Update] I putting Update here because I wanna must explain my error and what I do to solve
well first I wrong on calculate
Vector3 toPos = (playerPrefab.transform.position + originalDist);//calculate the destination
like my cam is anothet tipe (I’ll make another type of RPG and with the help of this course it’ll be fantastic)
I’m use a Vector3.SmoothDamp()//I use 1/3 SmoothDamp API
and because that I need rotate correctly my Camera, on my code (linked on bellow section) I declated one default position to my camera with the X != 0 and when Ethan turn around and the camera turn with him because I do a transform.LookAt() on Ethan and the camera X rotation have a wrong value because of defaultDistance value, the worng calculation of destination, the worng values to my SmoothDamp() and the result to the .LookAt() but now I change the defaultDistance to
[SerializeField]Vector3 defaultDist = new Vector3 (0f, 7, -10);//seta uma distancia padrao para camera
the toPos Vector3 calculte to
Vector3 toPos = playerPrefab.transform.position + (playerPrefab.transform.rotation * defaultDist);//um vetor para indicar a posisao do target e onde a camera deve parar
Hello I did a non-fixed camera on unity using a Vector3.Lerp() to follow my character on a good distance, but I did a logic to stop the camera when I stop to move Ethan, but I need to try think another logic to stop the camera only when is behind Ethan. Please if some one can help THANKS!
my two script over here on codeShare.io -> CamFollow.cs and PlayerController.cs
the CamFollow script is index on Camera Arm like course and PlayerController is on Ethan,
I match Camera on my Ethan script and Ethan on Camera script, is all nice with the camera but I need a think (and help with this =) ) a another logic to stop my cam behind Ethan =) thanks. I’ll post new things under this symbol [\EDIT] thanks every one.
I’ve Solved the problem changing my toPos variable to this
> Vector3 toPos = (playerPrefab.transform.position + originalDist);