I'm literally going insane
So I'm making a Tower Defense game when you press b it changes from fly mode to build mode and vice versa, when switching from fly mode to build mode it adds a random z value to the camera rotation for no reason, I'm so confused and I want to punch my monitor
![private void ModeSwitch()
{
if (Input.GetKeyDown(KeyCode.B) && isBuilding == true)
{
camAnimator.SetTrigger("Build2Fly");
StartCoroutine(Switch2Fly());
}
else if (Input.GetKeyDown(KeyCode.B) && isBuilding == false)
{
isRunning = false;
cam.transform.rotation = Quaternion.Euler(0, 0, 0);
camAnimator.SetTrigger("Fly2Build");
StartCoroutine(Switch2Build());
}
}
private IEnumerator Switch2Fly()
{
isBuilding = false;
yield return new WaitForSeconds(.20f);
isRunning = true;
Cursor.lockState = CursorLockMode.Locked;
StopCoroutine(Switch2Fly());
}
private IEnumerator Switch2Build()
{
yield return new WaitForSeconds(.20f);
isBuilding = true;
Cursor.lockState = CursorLockMode.None;
StopCoroutine(Switch2Build());
}][1]
[1]: /storage/temp/148527-screenshot-127.png
screenshot-126.png
(15.6 kB)
screenshot-127.png
(23.1 kB)
Comment
ignore the weird the weird brackets I'm not sure why it did that
Your answer
Follow this Question
Related Questions
Unity 5.2 Freezing when Resizing Game View after Play 0 Answers
Unnacounted in Unity 5.5 Android 0 Answers
[UNET] Weird Bugs On Player Join 0 Answers
Fix Player Movement Script,Fix Player Movement 0 Answers
iPhone 5 distorted 3D models 1 Answer