CCPhysics area/density properties.
So I commented out these two properties a couple of weeks ago. The problem was that the area of a node can be changed by changing it, or an ancestor's transform. The actual body isn't set up until it enters an active scene. So you could get a non final value or set an incorrect density if not careful with operation order. Secondly, by adding the CCPhysicsShape type and allowing composite bodies, setting the density of a body is somewhat poorly defined.
Both properties seemed pretty useful. I left them out of the alpha to make sure that the issues above were thought through carefully.
I'm sort of changing my mind about this. An overwhelming majority of the time, CCNodes use only rigid transforms (position/rotation) and it wouldn't be an issue in those cases at all. Furthermore, it's not like there aren't other methods such as the bounding box or transform ones that depend on the current node's (and it's ancestor nodes') setup when returning results.
Should I just put the area/density functions back in? Is a comment about this in the documentation sufficient to explain the issue?
edit: Ended the first paragraph with an incomplete sentence. >.>
Hierarchies tend to be pretty flat too, in addition to not often being scaled. I think just mentioning this in docs should be sufficient.
Already, you can scale physics bodies and their mass isn't affected. So it seems reasonable.
Most of the use of scaling parent nodes is probably for UI sorts of things.
Seems to me that accessing the area and density are much more important than correctness when scaling. My vote goes to putting them back in.
I can not really grasp what implications this have. What is the difference between mass and density? Never used area. On the other hand, I have used objects scaling extensively ... ie the unsafe resize functions in old chipmunk. Would hate to lose that.
Mass is a...
Density has a...
Sent from my iPad
On Nov 22, 2013, at 5:26 PM, Birkemose [email protected] wrote:
I can not really grasp what implications this have. What is the difference between mass and density? Never used area. On the other hand, I have used objects scaling extensively ... ie the unsafe resize functions in old chipmunk. Would hate to lose that.
Reply to this email directly or view it on GitHub.
Pushed. I ran into another issue that I'd forgotten about from earlier that I'd been mulling on for a couple of days. I think the code for it had ended up in my git stash a half dozen times. :-\ Found a dumb, but correct solution. (Need to guess the non-rigid part of a node's transform before it's physics body is even active.)