When I add a body with 0 mass it seems to not really get created. In fact, it kills the rest of the simulation, not letting me process touch events. I get no error or warning in the console. There are other circumstances that create this "non-fatal fatal error", but this one is the least "workaroundable".
I want to add a shape which processes collisions but doesn't actually impart force (mass 0). If there's a designated way to do this I'm game. Thanks again.
Body with 0 mass?
-
- Posts: 16
- Joined: Sat Nov 26, 2011 1:09 pm
- Contact:
Re: Body with 0 mass?
I considered making a shape standalone but these require shapeWithBody:body type construction.
-
- Posts: 16
- Joined: Sat Nov 26, 2011 1:09 pm
- Contact:
Re: Body with 0 mass?
I have found that I can still create the body with zero mass, I just can't actually add it to a space. However, the body can still be used to create a shape, which can be added as normal. The body will be available for later use. Since a body with no mass probably doesn't interact with other objects anyway (in any meaningful sense), this solves the problem for me.
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Body with 0 mass?
Yeah a body with 0 mass would cause a lot of divide by zero issues and such which tend to be silent errors unless you catch them specifically. I'm adding assertions to throw errors when creating a body with 0 or negative mass/moment.
If you want to work with a physics engine, you have to accept that things simply can't be 0 mass and still be able to be used in a simulation in any meaningful way. The best you can do is to give the object a very small mass.
If you want to work with a physics engine, you have to accept that things simply can't be 0 mass and still be able to be used in a simulation in any meaningful way. The best you can do is to give the object a very small mass.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Who is online
Users browsing this forum: No registered users and 24 guests