Rotation on the Z axis not happening
Hi !
My problem is pretty simple, I have a plane, I have a camera, I want my camera's rotation to be the one's of the plane, it is currently tracking fine but it doesn't perform any rotation which is PRETTY weird since I basically set the cameras rotation to be the one's of the plane.
For some reason the only axis that isn't properly applied is the Z axis, but I have no clue as to why.
Pic of how it currently looks :
Pic of how it should look (after pausing and manually editing the camera's rotation Z axis) :
And my code :
private void PlaceCamera()
{
this.transform.position = target.position + (-target.forward * distance) + (Vector3.up * height);
// FREE CAMERA
if (Input.GetMouseButton(1)) Orbit();
else
{
transform.rotation = Quaternion.Lerp(this.transform.rotation, target.rotation, Time.deltaTime);
transform.LookAt(target);
}
}
I already tried setting the rotation, the local rotation, but nothing helps !
Any thoughts ?
Answer by valentin56610 · Nov 26, 2021 at 07:16 AM
SOLVED : Apparently, for some reason, the "transform.LookAt(target);" bit resets the rotation or something ? I don't know why, but removing this solved the problem !
Your answer
![](https://koobas.hobune.stream/wayback/20220613045842im_/https://answers.unity.com/themes/thub/images/avi.jpg)