Attract bodies to each other
Posted: Mon May 23, 2011 3:33 pm
Good day all.
I have a case where I have a static, horizontal line defined. Based on an event, I push new bodies onto the line so they are arranged horizontally. I use cpBodyApplyImpulse to push the new bodies in from right to left. What I really want is to have all the bodies attracted to each other like magnets so once a new body gets pushed in, they all stick together and the last ones don't drift off. Once too many objects get added, I do want the last ones to fall off the cliff.
Is there a way to define attraction or per-body gravity?
Thanks!
I have a case where I have a static, horizontal line defined. Based on an event, I push new bodies onto the line so they are arranged horizontally. I use cpBodyApplyImpulse to push the new bodies in from right to left. What I really want is to have all the bodies attracted to each other like magnets so once a new body gets pushed in, they all stick together and the last ones don't drift off. Once too many objects get added, I do want the last ones to fall off the cliff.
Is there a way to define attraction or per-body gravity?
Thanks!