Hi all,
I'm trying to get an effect from Box2D. I have a game that is overhead, basically with all physics turned off, and I'm only using Box2D for collision response.
I have a player character-- represented as a sphere-- and anywhere from 5 to 50 other spheres constantly are converging on him, Robotron style. The idea of the game is to not get swarmed too badly.
So here's the problem: I want my player character to get pushed around-- but not too much. So if I make him very dense, no problem... he doesn't get shoved around by the horde of chasing objects much.
Except: I want the player's pushing power to be very limited! That is to say, he doesn't have the "strength" to push his way out of the horde. But with Box2D, when I make him dense enough to not be pushed all over the screen by the pursuing bad guys, he's strong enough to shove them all out of his way without a problem.
What I want to do is sort of break my character's attributes apart... I want everyone to have "density" and "strength." Density is how heavy you are, strength is how well you can push away someone else's density. This is also important because my horde of monsters is able to shove their friends out of the way too, so when I try to do some effects like having one pause and "think" it just gets shoved along, because they all have the same density.
I got the idea that I could grab the PostSolve collision impulse and modify it based on the strength, so that the pushing behaves differently... except I can't seem to access the impulse data, and I'm not sure it hasn't already been applied at that point anyway.
Can anyone help? I'm willing to modify the Box2D code-- in fact, I've been trying to, and I've had very limited success mostly because the collisions are simultaneous and I'm trying to adjust the object's mass on the fly to reflect their strength relative to eachother. That ain't working out so well.
Thanks, I appreciate any help you can give.
TLDR: I want to modify Box2D somehow so objects have a "push strength" seperated from their density-- so a heavy object could have very little ability to displace other objects. Essentially, I want to make objects able to absorb some of their impacts so they don't move as far when pushed.