[SOLVED]I need help to solve a question on follow cam rotation

LOL I see my error I changed on line 33 transform.LookAt (camPoint.position, camPoint.up); to transform.LookAt (camPoint.position, camPoint.up);

Hello! first thing I need to say is, my camera is different, I wanna make a game like a Adventure/RPG focus on gameplay with less conversation focus like Oblivion or the Witcher and on my camera I’ve use the Vector3.SmoothDamp() and transform.LookAt() method and following a point on player (a EmptyObject) to the camera follow and the problem is when the player turn around L/R the CamArm rotate on Z the limit is -4 and 4 if holding W key and -8 to 8 if W is not hold when x->0 the minor value I see are Z: 0.0025 I think the problem is on the line 31 of mine script take a look (bellow I’ll post the code)

//camPoint is a Transform and defaultDist a Vector3 each one [SerializeField]
Vector3 toPos = camPoint.position + (camPoint.rotation * defaultDist);//were u need to go and rotate (if you turn around)

if some one can help me thank! here my code

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CamFollow : MonoBehaviour
{
	[SerializeField]Vector3 defaultDist = new Vector3 (0f, 5.78f, -19.56f);//seta uma distancia padrao para camera
	[SerializeField]float velDamp = 0.25f;//distancia maxima do afastamento da camera

	Transform camPoint;
	GameObject playerPrefab;
	Vector3 velocity = Vector3.one;

	void Awake()
	{
		playerPrefab = GameObject.FindGameObjectWithTag ("Player");
		if (playerPrefab)
		{
			camPoint = playerPrefab.transform.Find ("CamPoint");
		}
	}

	//Update apos FixedUpdate e Update
	void LateUpdate()
	{
		SmoothFollow ();
	}

	void SmoothFollow()
	{
		Vector3 toPos = camPoint.position + (camPoint.rotation * defaultDist);//um vetor para indicar a posisao do target e onde a camera dee parar
		transform.position = Vector3.SmoothDamp (transform.position, toPos, ref velocity ,velDamp);//um vertor smoothdamp para mandar a camera se mover
		transform.LookAt (camPoint.position, camPoint.up);
	}
}

please some help I don’t know what I can do or use to stop this.

Privacy & Terms