Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
This question was closed Jan 15, 2017 at 12:03 AM by Bunny83 for the following reason:

Problem is not reproducible or outdated

avatar image
0
Question by MrKagouris · Jan 14, 2017 at 06:18 PM · camerarotationerror

Camera rotation error: "Input rotation is { NaN, NaN, NaN, 1.0000 }

I'm getting the error "transform.localRotation assign attempt for 'Main Camera' is not valid. Input rotation is { NaN, NaN, NaN, 1.000000 }.". The problem with this is that as far as I can tell I'm not doing anything that should result into NaN being fed into the offending method. The error message points to line 69 of this script. For context, I'm building up my own third person controller, and I've basically cannibalized the Standard Assets MouseLook script. My controller script is:

 [SerializeField]private ThirdPersonMouseLook MouseLook;
 
     public float Debug_TimeScale;
 
     public GameObject EscMenu;
 
     private CapsuleCollider PlayerCapsule;
     private Rigidbody PlayerRigidbody;
     private Animator PlayerAnimator;
     private Vector3 CapsuleCenter;
     private float CharHeight;
     private bool CameraEqualPlayerRotation;
 
     private void Start ()
     {
         Time.timeScale = Debug_TimeScale;
 
         PlayerCapsule = GetComponent<CapsuleCollider>();
         PlayerRigidbody = GetComponent<Rigidbody>();
         PlayerAnimator = GetComponent<Animator>();
         CapsuleCenter = PlayerCapsule.center;
         CharHeight = GetComponent<MeshFilter>().mesh.bounds.extents.y;
         PlayerRigidbody.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezeRotationZ;
         MouseLook.Init(transform, Camera.main.transform);
         EscMenu.SetActive(false);
     }
 
     private void Move ()
     {
         if (Input.GetKey(KeyCode.W)) {PlayerAnimator.SetBool("Forward", true);} else {PlayerAnimator.SetBool("Forward", false);}
         if (Input.GetKey(KeyCode.A)) {PlayerAnimator.SetBool("Left", true);} else {PlayerAnimator.SetBool("Left", false);}
         if (Input.GetKey(KeyCode.D)) {PlayerAnimator.SetBool("Right", true);} else {PlayerAnimator.SetBool("Right", false);}
         if (Input.GetKey(KeyCode.S)) {PlayerAnimator.SetBool("Back", true);} else {PlayerAnimator.SetBool("Back", false);}
         if (Input.GetKeyDown(KeyCode.LeftControl) && PlayerAnimator.GetBool("Crouch")) {PlayerAnimator.SetBool("Crouch", false);}
         else if (Input.GetKeyDown(KeyCode.LeftControl)) {PlayerAnimator.SetBool("Crouch", true);}
         if (Input.GetKeyDown(KeyCode.T) && PlayerAnimator.GetBool("Walk")) {PlayerAnimator.SetBool("Walk", false);}
         else if (Input.GetKeyDown(KeyCode.T)) {PlayerAnimator.SetBool("Walk", true);}
     }
 
     private void EscMenuCheck()
     {
         if (Input.GetKeyDown (KeyCode.Escape) && !EscMenu.activeInHierarchy)
         {
             EscMenu.SetActive(true);
             Time.timeScale = 0;
             MouseLook.SetCursorLock(false);
             MouseLook.XSensitivity = 0f;
             MouseLook.YSensitivity = 0f;
         }
         else if (Input.GetKeyDown (KeyCode.Escape))
         {
             EscMenu.SetActive(false);
             //Time.timeScale = 1;
             Time.timeScale = Debug_TimeScale;
             MouseLook.SetCursorLock(true);
             MouseLook.XSensitivity = 2f;
             MouseLook.YSensitivity = 2f;
         }
     }
 
     private bool GroundCheck()
     {
         if (Physics.Raycast (transform.position, Vector3.down, CharHeight/2f)) {return true;}
         else {return false;}
     }
 
     private void Update()
     {
         MouseLook.LookRotation(gameObject.transform, Camera.main.transform);
         EscMenuCheck();
         Move();
     }
 
     private void FixedUpdate()
     {
         MouseLook.UpdateCursorLock();
     }

I really can't see anything here that would result in this problem. Any help would be really appreciated.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image MrKagouris · Jan 14, 2017 at 06:45 PM 0
Share

Alright, I fixed this. The Game Object didn't actually have a mesh filter, so when I referenced the non-existent mesh filter it caused this problem.

avatar image AurimasBlazulionis MrKagouris · Jan 14, 2017 at 07:33 PM 0
Share

Close the question, please.

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

106 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

how to fix automatic camera rotation when using joysticks? 0 Answers

How to make the camera NOT rotate with it's father 1 Answer

Camera Rotation Around Player 1 Answer

Object position/rotation after animation has finished to play. 0 Answers

Clamping Between Two Different Ranges 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges