- Home /
How to fix !IsNormalized (dir) error
Hello! The error I am gettnig is !IsNormalized (dir)
the error points to this code: var ray : Ray; ray = Camera.main.ScreenPointToRay (Vector3((Camera.main.pixelWidth/2),(Camera.main.pixelHeight/2), 0));
How would you fix an error as such?
This is a bit of a weird one. The error here should only occur when you pass a non-normalized vector to a ray constructor, but since the ray gets created automatically, I would have assumed such a thing was impossible! Are you sure it's that line? What happens if you use
Camera.main.ViewportPointToRay(Vector3(0.5, 0.5, 0));
ins$$anonymous$$d? (yes I know it doesn't quite do the same thing, but it'll help narrow the bug down).
found out a bit more information I am also getting an error of "Screen position out of view frustum" Looking into what a frustum is and I figured it out. (I was moving my camera too fast.)
Answer by Jameslewood · Oct 15, 2013 at 10:17 AM
Anyone else coming across this, I managed to get the error and a few others because I applied a lens flare to a camera instead of to an object. Just need to remove it from the camera.
Your answer
Follow this Question
Related Questions
Run-Time Errors! Particle Instantiations 1 Answer
Console Error while in editior 4 Answers
Confusing error messages, !IsNormalized and NxRay direction not valid 0 Answers
Assertion failed: Assertion failed on expression: 'IsNormalized(normal, 0.001f)' 0 Answers
Scene::raycastAnyShape: The maximum distance must be greater than zero! 3 Answers