Hi everybody,
I'm making a game in Actionscript 3 where there can up to about 350 small square objects (all the same size, with fixed rotation) that move and can collide with each other. I don't really need the physics part of Box2D, my real problem is making sure that objects don't overlap. I tried making my own algorithm, but this is difficult because in my game objects can spawn anywhere, so it needs to work well in separating objects when they're all clumped together and objects can be created in the middle of them.
I also need that when an object collides with another, that it doesn't "push" it. For example, if an object collides straight on with a stationary (but dynamic) object, the stationary object should remain in the same position, while the object that collided with it stops. So basically the only way for an object to move would be for me to move it directly with SetLinearVelocity().
I already tried out Box2D, but unfortunately the performance isn't quite as good as I need (even with only 1 velocity and position iteration), and I can't find a way for the objects to react (or "not react") as I need.
Is there anything I can do to make the performance better, and make objects not "push" each other (unless to remove them from a collision of course)? If not, is there another collision engine I should be looking into, or perhaps an algorithm I can learn and try to implement?
Thanks in advance!
I'm making a game in Actionscript 3 where there can up to about 350 small square objects (all the same size, with fixed rotation) that move and can collide with each other. I don't really need the physics part of Box2D, my real problem is making sure that objects don't overlap. I tried making my own algorithm, but this is difficult because in my game objects can spawn anywhere, so it needs to work well in separating objects when they're all clumped together and objects can be created in the middle of them.
I also need that when an object collides with another, that it doesn't "push" it. For example, if an object collides straight on with a stationary (but dynamic) object, the stationary object should remain in the same position, while the object that collided with it stops. So basically the only way for an object to move would be for me to move it directly with SetLinearVelocity().
I already tried out Box2D, but unfortunately the performance isn't quite as good as I need (even with only 1 velocity and position iteration), and I can't find a way for the objects to react (or "not react") as I need.
Is there anything I can do to make the performance better, and make objects not "push" each other (unless to remove them from a collision of course)? If not, is there another collision engine I should be looking into, or perhaps an algorithm I can learn and try to implement?
Thanks in advance!