Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 /
avatar image
0
Question by DeanMarquette · Aug 08, 2015 at 01:25 PM · ridgidbody

How can I prevent Input position is {NaN, NaN, NaN} error?

Hi, I get this error ever so often but its not consistent so I cant tell whats causing it. After awhile or sometimes right away my player gets stuck and I get this rigidbody error:

rigidbody.position assign attempt for 'Man2(Clone)' is not valid. Input position is { NaN, NaN, NaN }. UnityEngine.Rigidbody:MovePosition(Vector3) SCR_character:UpdateMovementFixed() (at Assets/UAGK/Scripts/SCR_character.cs:263) SCR_character:FixedUpdate() (at Assets/UAGK/Scripts/SCR_character.cs:251)

Here is line 263:

GetComponent().MovePosition(new Vector3(GetComponent().transform.position.x,0f,GetComponent().transform.position.z)+(speed[0]*Time.deltaTime));

Is there a simple work around or how can I go about identifying the probllem?

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 Mazer83 · Jan 12, 2018 at 08:46 PM 0
Share

Just a comment: It's inefficient call GetComponent() every time to get the transform. You should get it once (in Start() or something) and assign it to a member variable.

avatar image Owen-Reynolds Mazer83 · Jan 12, 2018 at 09:03 PM 0
Share

I'm sure you're trying to be helpful, but UA works best when comments are specific to the question. Otherwise (and this has happened) you get Q's where the useful info related to the Q is pushed to the second page.

But I just now moved this Q into the Help Room area (since it's about C#, not Unity.) The Help Room is basically a chat room, with lots of flailing around type Qs from beginners. It's fine to write just about anything there.

1 Reply

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by Owen-Reynolds · Aug 08, 2015 at 05:24 PM

NaN means "not a number" (look it up and check.) It means you made a mistake somewhere in your program and got a junk value. Often dividing by 0.

It's, obviously, contagious. So, your position is probably bad because something in the equation to make it is bad. I'd guess there's an error with your speed. Do the usual, add Debug lines, etc... to check it. Sometimes if you aren't moving, you can get funny errors with speed/facing.

Comment
Add comment · Share
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

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

getting information from the object you collide with 0 Answers

Death animation for enemy 0 Answers

Ui Collision Detection 0 Answers

Ridgidbody with non-convex meshcollider, Is there any workaround? (Necessary for RaycastHit.textureCoord) 0 Answers

Can't move player with this code why?,I cannot move my player with this code why? 0 Answers


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