- Home /
How Make Camera Look at Player axis X and Z
can someone tell me why the camera is shaking on the Z axis?
void LateUpdate ()
{
My_Vision();
}
void My_Vision(){
targetPosition = new Vector3(Distance,y,z);
// the problem is that why the camera stay shaking in axis Z?.
targetPosition.z = follow.transform.position.z-z;
targetPosition.x = follow.transform.position.x-x;
targetPosition = new Vector3(Distance,y,z);
targetPosition = Vector3.Lerp(transform.position, targetPosition, Time.deltaTime * smooth);
transform.position = targetPosition;
}
What is 'z'? What is 'y'? What is 'Distance'? Line 5 completely overwrites the calculation done in line 3. Note that often shaking issues can be solved by putting camera movement code into LateUpdate().
axis z and axis y i want make the camera follow the player in axis Z and Y with smooth...
You are still blowing away all the calculations you do on lines 11 and 12 when you get to line 14. And I don't understand what role using 'x' and 'z' play in calculating the follow. $$anonymous$$aybe replace lines 10 - 14 with???:
targetPosition = follow.transform.position;
targetPosition.x = Distance;
i did this but the camera still are trembling :(
targetPosition = follow.transform.position;
targetPosition.x = Distance;
targetPosition.y = height;
targetPosition = Vector3.Lerp(transform.position,targetPosition, Time.deltaTime *smooth);
transform.position = targetPosition;
Your answer
Follow this Question
Related Questions
My Camera lookAt script doesn't work 0 Answers
Player rotates with camera(face same direction as the camera) 1 Answer
how to make player looks at mouse 1 Answer
Make Prefab Look At Target 2 Answers