- Home /
!CompareApproximately (det, 1.0F, .005f)
I've got a big battle going on, lots of flying objects etc. Worked fine for days. Then all of a sudden I start getting these errors.
!CompareApproximately (det, 1.0F, .005f) UnityEngine.Transform:LookAt(Transform, Vector3) (I have verified that the object to look at exists. and is within reasonable position within the scene.)
transform.position assign attempt for 'Bullet' is not valid. Input position is { NaN, NaN, NaN }.
transform.localRotation assign attempt for 'MuzzleFlash' is not valid. Input rotation is { NaN, NaN, NaN, NaN }. UnityEngine.Transform:set_localRotation(Quaternion)
transform.rotation assign attempt for 'Base' is not valid. Input rotation is { NaN, -0.469401, 0.645964, 0.437326 }. UnityEngine.Transform:set_rotation(Quaternion)
transform.position assign attempt for 'CombatCamera' is not valid. Input position is { NaN, NaN, NaN }. UnityEngine.Transform:set_position(Vector3)
And then it just build up more and more.
Any Idea whats causing this? is this a Unity Bug?
Answer by Tryggvienator · Mar 25, 2014 at 01:20 AM
Okay.. Just solved my own problem. It seems that a missing reference to a script was causing this. Undetected by a try catch clause. This caused a chain reaction across my project, affecting everything mentioned above. Wow.
This wrecked my project. Lesson learned.
I have the same problem and i'm not sure if this also happened to you but did you get another error saying 'F$$anonymous$$OD failed to get driver capabilities ... Error initializing output device' and have nothing in the scene or game view. Also, how did you fix the problem if you did. (I still have all my assets but nothing in the scene or hierarchy)
Never $$anonymous$$d what I just said. I just didn't have the scene selected. But i still am getting those errors when I start up the project and for some reason a random tree texture appeared in my assets. Had a heart attack there.
Answer by Partel-Lang · Jul 21, 2016 at 06:22 PM
It usually happens when you have a logical error somewhere in your calculations (for example division by zero) and you attempt to make a Quaternion based on that calculation. The easiest way to reproduce this error is with code like this:
Vector3 v = Vector3.one;
v /= 0f;
Quaternion r = Quaternion.LookRotation(v);
So if you get this error, debug what your functions return and if there is a NaN or Infinity anywhere, it might be it.
Thank you for the explanation. In my case the input vector left the bounds of a float because I set a comparing operator in the wrong directions :/ (At least I think that happened, it grew exponentially with each frame)
Your answer
Follow this Question
Related Questions
Enemy circling around the player when using LookAt 1 Answer
How Can I Stop Rotation From This Script? 0 Answers
Changing the forward rotation for LookAt 2 Answers
Look at like rotating around y axis 1 Answer
SphereCast help 1 Answer