Jump to content
• Advertisement

#### Archived

This topic is now archived and is closed to further replies.

# Collision physics

This topic is 6046 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

I''ve done the simple mechanics for colliding speres (momentum, restitution, energy considerations) but need to expand them to real world tye stuff: first, imagine two metal bars. One swings and somepoint along it''s length collides with some point on the other bar. I fugure this is reasonably simple? Then have the bars connected at one end e.g two people holding swords when the swords clash. The swords are metal so should rebound but they don''t - is this due to poor restitution coefficiants of the people or what? Basically I want to have to robots that are physically accurate that can fight. But you''ve got to have connected body parts. Can this all be modelled using simple A-level type mechanics? Eventually I want to have deformable stuff like If I jump on the other guy''s leg it bends - but that''ll be a lot later!

#### Share this post

##### Share on other sites
Advertisement
> Can this all be modelled using simple A-level type mechanics?

Yes and no. The bulk of the mathematics is A-level standard, but some is more advanced, in particular the rotational mechanics is usually not covered until degree level mathmatics.

But even that''s only half the picture. Although the mathematics is mostly A-level mathmatics it is used in fairly involved ways, going far beyond what is done at A-level. So more advanced experience/training may be needed to make full use of it.

#### Share this post

##### Share on other sites
The reason the swords don''t rebound is because the force of the impact between the two swords is ''absorbed'' in the arms of whoever is holding the sword. The wrist joint(or elbow etc) is flexible so it can bend (rather like a (damped)spring) to deaden the impact.
Also the motion of the swords after the collision depends strongly on the pointon the sword at which the collision occurs (like if a sword is hit close to the hand it will make the hand move sideways, but if the collision is near the sword tip then the sword will more likely rotate),

So the actual motion of the sword is a combination of linear + rotational motion. This all has to be linked to the hand by a spring type arrangement to produce the deadening I mentioned above. The hand then has its own inertia and so on through all the different body parts.

Damped springs aren''t A-level material but it is first year undergraduate stuff, so look in a classical mechanics textbook

#### Share this post

##### Share on other sites
I''m in my second year of a phsics degree so I''m sure I''ve done the stuff but:
How do you combine the impulse generated by colliding particles with moments and stuff involved with lengthy rods.
I will assume an inflexible massy rod. How does one model a joint with friction - rotational friction?

#### Share this post

##### Share on other sites
I think a good way to start modelling this problem is to break it down into bits, namely the response of the rod to a collision and the response of the joint to the force from the rod.

So the rod: probably the easiest way to think about this problem is first to look at the forces imparted onto a stationary sword by an impact at some point along its length (ie don't worry about two swords moving, use a frame where one sword is stationary)
At the collision say we know how far along the rod from the pivot point the collision occured and the force applied (excuse horrendous ascii art )

|
|
|
|<- collision occurs here, call the distance to the pivot 'r'
|
|
P

then the response of the sword is equivalent to a sideways motion + a rotation about the pivot:

[there was a pretty picture but the html won't come out right ]

The sideways acceleration is found from newton II : f=ma
The rotation acceleration is due to a torque which depends on the moment of inertia of the bar and the distance r (can't remember the equations off the top of my head )

So that's where you account for the lengthy rod, in the moment of inertia.

As for the rotational friction in the joint:
This could get really detailed and I'm not sure how people model the joint simply in normal apps, but there are some key points that I think are neccessary:
1) the rotational friction acts to slow rotation of the joint equally around both possible axes of rotation.
2) the joint can only rotate so far (unless your robots are contortionists)

In coupling your sword(and hand say) to the arm via this joint, you need the joint to be able to respond to both the rotational and lateral forces. The rotational part depends on those points above, but the lateral part should be easier - just give the joint some mass so it resists moving sideways when force is applied by the sword.

Have you thought about how your other body parts join together? Do they have masses? You said the robots should be physically accurate...

And finally, theres going to be a shed load of resolving weird forces in 3d at strange angles going on so good luck with that!

Hope that was food for thought anyway!

foamer

Edited by - foamer on February 21, 2002 5:41:11 PM

Edited by - foamer on February 21, 2002 5:42:28 PM

#### Share this post

##### Share on other sites
Yeah that does all help.
1)Rotational friction:
In real life this would be generated by normal friction as nothing has zero width dimensions. i.e a lever can be made stiffer by ticghtening the bolt that it rotates around.
2)Colliding swords:
Surely when one line collides with another a force isn''t imparted. Well obviously it is but to all useful purposes I wanted to treat it like an instantaneous velocity change like when we model colliding particles - we just say before the collision it''s like this and after it''s like that. With our particles I used momentum conservation and restitution which tells us how much energy is lost during the collision i.e how elastic the collision is.
3)The robot models:
Basically I want to start of with stick men as this makes centre of mass and moments of inertia real easy to calculate. This will later extend to a realistic body (visions of generating moments of inertia about arbitrary axes will be a pain I think?) Initially I''ll model the lines as unbendable bars with some mass/length. Muscles/motors will be modelled by a force between two points on the body i.e from mid-thigh to mid calf that can be turned up or down. Ideally the joints would be some squashy thing but I think I''ll model them as a very stiff spring with some short unstreched length. One thing on this - I want a spring that compresses so that the length can never get to 0 ie the energy stored goes up exponentially(?) with compression. That would seem more realistic to ie a lump of rubber being squashed.
Eventually I want the 3d model to bend and smash realistically like the stell shell gets punctureed by a sword.
4)Stopping limbs rotating too far:
In the proper 3d model I think I''ll let this work by collision detection and forces and stuff - when you try and bend your leg forwards aty the knee something bangs into something else, or maybe there just isn''t a musclew to do that. With the stick man maybe I''ll restrict motion to certial planes or limit the angles.
5)
I can get a force representation of my stick man working ok I think, but then I''m going to want to write something to work out how he can stand up or even run! I figure that''s going to be the real problem - but that''s probably more ai than physics.

6)
How long is all this going to take me?

#### Share this post

##### Share on other sites
A few more thoughts:
1) rotational friction: in real life the friction of a ball and socket joint would be proportional to the area of contact between the ball and the socket, and inversely proportional to the relative velocity of ball/socket. The friction coefficient would just be a constant though...
2)colliding swords: Modelling the sword as particles that conserve momentum is the same as modelling forces - a force causes the change in momentum. If you were to work out the location of the impact along the sword then that impact occurs at a point, just like two colliding particles.

The difference with this system is that you don''t have ''free particles'', everything is joined (by springs or rods) to something else, all through the body so you have to work out the forces on each component. Eventually the friction between feet and ground stops the robot sliding along as it takes a collision to its sword (assuming the sword doesn''t only have rotational motion).

Theres another thing too - its possible for the swords to slide over each other. This shouldn''t be too hard to model though since a glancing blow would cause sliding (again slowed by sword-sword friction) and a ''straight-on'' blow would cause no sliding - hence the sliding has a cosine dependence on the angle of orientation of the two swords.

3)robot models: This sounds like a really good way to handle the joints and muscles, and as long as the springs are stiff enough with short enough ''natural lengths'' then I don''t see problems with energy going to infinity (could check for this like a divide by zero check)

5)robot motion: when its running or whatever you might need to think about the centre of gravity of each body section - ie the point the mass acts through. This would also determine whether the joint rotates or moves laterally. (I think???)

6) I think this is a very complicated problem, and I never got very far trying to solve it: I was modelling a stick man where each body part was represented by a particle - each particle interacted through a kind of potential like atoms in a solid - attracted together but can''t get too close. Thing is I ended up with this great little particle engine in its own right and lost interest in the stick man aspect!
But I''m sure its been done - somehow or other (like in Black & White for example) , so good luck!

foamer

#### Share this post

##### Share on other sites
I''m looking at this and come to some basic conclusions
1)Split into angular and linear parts
2)Use conservation of linear/rotational momentum and kinetic energy (assuming elastic type collisions)

At first I thought I could model two bars collising that aren''t attached to anything - that is fairly simple I think. Then I was going to apply the forces caused by stretching the springs representing joints to slow it down. But will that work or do I have to look at everything linked to each bar to work out how the collision will work. That sounds complicated - if two guys clash swords I''ve somehow got to look at the sword joinging the arm, then arm to body, body to leg, leg to whatever the guy is standing on. I''m not sure how you''d resolve forces or anything in that situation. Please tell me I can just collide the swords and then stop them elastically colliding away by trating them as the only colliding things and applying the resultant motiion to the joints...

#### Share this post

##### Share on other sites
Some things to consider for this project...

Thick bars, when struck together, will rebound. Swords when struck together do one of three things (depending on angle, strength of the blow, quality of the metal and the skill of the swordsman): 1) A glancing blow is struck, the striking sword deflects the parrying sword and continues to move in nearly the same path as before contact (depends on the quality of the strike); 2) the swords rebound... this only happens if the blades are heavy enough and the blows weak enough... what usually happens is; 3) The weaker sword breaks. While it doesn''t happen in the movies much, in reality, if a blade is struck with enough skill it will snap at the point of contact.

(I have a fair bit of training in Kenjutsu, Kendo and Jiu Jitsu so I can offer practical advice based on experience of trying to beat up - and defend against - people with swords).

As for simulating a body with limbs and joints, this is actually a very difficult numerical computation if you want to actually control the agent by moving ''muscles''. Many advanced students, postrgrads and industry researchers have tried solving this in software and have failed. The very rare hardware implementations are normally very complex and employ adaptive controllers that must be trained to cooperate with each other to affect motion of various sorts. I highly recommend that you don''t try this unless you are a) very knowledgeable in advanced mechatronics simulation; or b) insane.

Doing a fudge system would be far easier and most people would never know the difference.

Cheers,

Timkin

#### Share this post

##### Share on other sites
What kind of things would you do to ''fudge'' it? I''d like it to act as if driven by muscles so I can build AI for walking by using individual muscles, but at the same time I don''t want to have to solve 78 simultaneous eqns! I think I could get the physics of a guy working ok but only if he didn''t interact with anything - ie he could walk jump somersault (eventually) but collisions would be a whole new ketle of fish.
So yeah, what kind of approximations would I make? Could I ie treat the guy when swords clash as a sword joined to one thing representing the whole of the rest of the body?

One thing - initially I want to work with a rigid body system with springs etc to give stretchiness where required, but then I finally want a deformable engine. I figure in some respects that might actually be asier as it''s more realistic - rigid body physics is always a fudge to some extent!

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
3. 3
Rutin
22
4. 4
frob
17
5. 5
• Advertisement

• 9
• 33
• 13
• 13
• 10
• ### Forum Statistics

• Total Topics
632581
• Total Posts
3007197

×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!