Fixed camera bug

This commit is contained in:
Gregory Campbell
2020-02-09 17:28:51 -05:00
parent 072271a9e9
commit a728e7518a
8 changed files with 11 additions and 6 deletions
+4 -3
View File
@@ -13,6 +13,7 @@ public class CameraController : MonoBehaviour
public Transform player;
public Transform pivot;
public Vector3 offset;
public Transform target;
void Start () {
if(!useOffsetValues){
@@ -20,7 +21,7 @@ public class CameraController : MonoBehaviour
}
pivot.position = player.position;
pivot.parent = null;
pivot.parent = target.transform;
}
@@ -40,8 +41,8 @@ public class CameraController : MonoBehaviour
controllerCamY = Input.GetAxisRaw("Right Stick Y") * (rotateSpeed * 200.0f) * Time.deltaTime;
}
pivot.Rotate(0, mouseCamX, 0);
pivot.Rotate(0, controllerCamX, 0);
target.Rotate(0, mouseCamX, 0);
target.Rotate(0, controllerCamX, 0);
if (invertY){
pivot.Rotate(mouseCamY, 0, 0);