Sign in to follow this  
Funkymunky

Object-Object pushing

Recommended Posts

Alright so I'm actually a little annoyed with myself over this one, but here's my question anyway. Say I have two objects, each represented by a mesh. I want the one to run into the other and push it. The one it runs into can either push back or just be a pushed. I know I'm going to have to use the equation f=ma, only i'm having trouble visualizing how that's going to work (and as such, how to convert it into code). I like pictures: So A is moving to collide with B. It accelerates to a max speed of 10 m/s, and has a mass of 2 kg. (these are arbitary #s) When it collides with B, how do i determine the effect it has on B? I want it to hit B and continue trying to push. I want B to either be moved by A or try to push back (which may either slow A down more if A is stronger, or reverse the direction of the collided pair if B is stronger) Can anyone help me with this? This is for a football game, not some homework problem. I'm annoyed with myself at having worked through numerous types of problems like this in the various physics classes i've had through the years without retaining a clue as to how to apply them in a situation like this. Anyway, thanks in advance!

Share this post


Link to post
Share on other sites
well, I suppose you could the formulae in this article to model the collision of the players as inelastic collision of two point masses.
It's a start.
At least you know at what speeds they should bounce off...
Once you know that the collision occured, you can keep sending one right onto the other and let the simulation decide which one should "win".

However, it would look rather unrealistic to simply model it this way...
I suggest you use the formulae to simply find the change in the players' velocity (without applying it), and then use it to calculate the force exerted on each player during the collision (mass*dv/dt). That force shouldn't be -totally- converted to acceleration, like in the simple, frictionless, point-mass model. There are many parameters you should consider...

E.g. if one player was leaning towards the other upon impact, his shifted weight would cancel out some of the force he would receive, and he probably wouldn't even have to make a step back.
Or, (advanced) convert some of the force to rotational momentum. Find how much of the total force has been exerted/absorbed by different parts of the body that came in contact, and apply the resulting torque.

Share this post


Link to post
Share on other sites
I do not have any experience with writing sports games, but I doubt that something like tackling is currently implemented in a "physical" way. I would guess that you would use a typical "attack/defence" resolution scheme (roll of the dice with benefits/penalties for player types, etc.) and then animate from there, perhaps letting the players go ragdoll once they winner is decided.

Share this post


Link to post
Share on other sites
I applied the formula in the link you gave me someusername and it actually gave some feasable results, probably due to the high framerate i'm getting. (even with vsync on, i have to check my rendering engine) This is definately a step in the right direction. Thanks! I'll post anything impressive I achieve

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this