-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot read properties of undefined (reading "x") #280
Comments
I remember there was a similar issue here: #269 Does it solve your issue? |
No, it doesn't- looking at the thread there, it was a specific circumstance where they had direct access to Planck and put in something blatantly wrong. In my case, I don't use any direct access to Planck, and input validation seems to be the issue. It happens a lot of times throughout my project, in seemingly random places, caused by different things. Something I'll try tomorrow is to put input validation into every crevace I can find in p5play, as I do have some knowledge on editing that. |
There is a variable (ASSERT) defined in "vite.config.js", you can set it to true to get more typing validation. You need to clone and build the project locally, tho. |
For anyone googling it in the future. I run into this problem in a pure non physics simulation situation. I wanted to find distances from one dynamic body to all static bodies in the world using Distance function and was getting those errors in console. The problem was with simplex cache variable. I wasn't setting it's count to 0 on each new static body in a loop as written in docs. |
I'm currently developing a game that uses p5play, and thus planck.js under the hood.
There's been a ton of circumstances where I've come across the same error-
Cannot read properties of undefined (reading "x")
in planck.js, scattered across a ton of functions- fromDistance
, to vector transforms, all stemming from thestep
call.From my hours of debugging these countless errors, I have never been able to pin it down to one function call, one variable that was NaN, or anything of the sorts. It's seemingly completely random, and drives me completely insane.
This is a plea to have an option to attempt to catch these kinds of errors- when there's something undefined, NaN or unusable, I expect the library to be able to tell me. Something similar to p5's friendly error system, non-existent in the minified version, perhaps, or handling these sorts of issues in a way where my entire program doesn't crash, and the offender is just excluded from the physics calculation.
All of these errors seem to look the same:
If I edit planck's code to try/catch that one function, another one appears. There's no way to tell what sprite or circumstances causes it, and thus no easy way to replicate it. It's such a frustrating issue that makes me want to just quit.
Please, any help here?
The text was updated successfully, but these errors were encountered: