-
Notifications
You must be signed in to change notification settings - Fork 2k
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 call Body.setDensity on a static body #640
Comments
The functions |
Yes - while this is no problem for Hype, I filed because I thought from an API perspective it would probably be better to at least not break physics bodies due to NaNs cropping up from setting this value. Seemed like a regression, as Hype was actually supplying Infinity to density already in static cases and that broke the same way. To take it further, it would be nice if the supplied values could be preserved; this way setStatic could be simply switched on/off and the body wouldn't need to be resupplied with the density. It seems more like an implementation detail for collision calculations that a static body has Infinity density. (But that's just my 2¢ as I already am working around it!) |
Yeah I think adding guards is a good idea then.
Agreed, it should be possible to implement that using the existing |
I'm not sure how much of a factor it is for what you are proposing, but I am swapping out the body.parts (via This is an upcoming feature in Hype; if there's a better way to change the vertices feel free to let me know. I need to keep the top-level body object (vs just create a whole new one) because there's also a new API for users to get at it and they may keep it around. |
Interesting; I got a report of a bug today that ended up having me look into this - please see #641. |
Calling Body.setDensity on a static body will yield invalid results.
This is a regression from Issue #378 (change f7d1877).
See attached example; the box bouncing off the ground will disappear when the ground's density is changed.
setDensityBug.zip
I can easily workaround by testing if it is static first.
The text was updated successfully, but these errors were encountered: