- Home /
My character is becoming distorted when looking around any ideas why this would happen? Also the view is inverted, can I change that?
Here is the code
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class PlayerPOV : MonoBehaviour { float camSens = 0.25f; private Vector3 lastMouse = new Vector3(255, 255, 255);
void Update()
{
lastMouse = Input.mousePosition - lastMouse;
lastMouse = new Vector3(0, lastMouse.x * camSens, 0);
lastMouse = new Vector3(transform.eulerAngles.x + lastMouse.x, transform.eulerAngles.y + lastMouse.y, 0);
transform.eulerAngles = lastMouse;
lastMouse = Input.mousePosition;
}
}
Answer by ahsen35813 · Apr 15, 2020 at 02:26 PM
I'm not sure about the view being inverted, but I am fairly certain that the character becoming distorted when looking around is because it is scaled differently in different directions. I am not entirely sure about this, but I encountered something similar when a child gameObject was rotating and the parent gameObject was scaled. The scale appeared to be applied to the child gameObject after it was rotated, but in relation to the parent gameObject. So if you try changing all the scale values to be the same, that might resolve the issue you are having.
I hope this helps! Sorry if I am wrong because I haven't tested this myself fully.
Thanks so much!! I tried this out and it worked perfectly!
Your answer
![](https://koobas.hobune.stream/wayback/20220612231347im_/https://answers.unity.com/themes/thub/images/avi.jpg)