Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

In my physics engine I give a body a value for restitution between 0 and 1. When two bodies collide there seems to be different views on how the restitution of the collision should be calculated. To me the most intuitive seems to be to take the average of the two but some seem to take only the largest one.

Are there other ways to do it? Also, could the closing velocity or some other parameter come into effect?

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

Also, could the closing velocity or some other parameter come into effect?

According to Wikipedia,

in a series of experiments performed at Florida State University in 1955, it was shown that the COR varies as the collision speed approaches zero, first rising significantly as the speed drops, then dropping significantly as the speed drops to about 1 cm/s and again as the collision speed approaches zero.

Sadly the link to the paper on this is dead.


To answer the main question, Cholesky's suggestion of a table is a good one, but if you want to reduce the number of cases you have to select values for then one approach would be to store for each material a base restitution and a weight with which to take a weighted average. What restitution is really about is how much of the energy of the collision is converted into forms other than the post-collision kinetic energy of the bodies. Sound can be neglected: what you're interested in is deformation. So give easily deformed materials such as soft sand a high weight and a low restitution and you have a model which should be good enough.

After all, games only have to feel right to the player: they don't have to be accurate simulations of the real world.

share|improve this answer
    
Citing an over 50-year old article, nice! :) I think we are getting somewhere now, so the weight you are talking about could probably be determined by the materials' "hardness" then? Sand would have high weight being soft and a brick wall having a low weight being hard? –  Mikael Högström Nov 17 '12 at 13:11
    
@MikaelHögström, it's about hardness in the sense of elasticity vs plasticity. I suppose that if you really want to simulate rather than approximate you could calculate forces and use tables of yield strength... PS I've e-mailed the author of that thesis to notify him of the broken links. –  Peter Taylor Nov 17 '12 at 13:27
    
So what about the brick wall? It isn't very elastic but still a rubber ball will bounce off it whith a high COR. It's not so much that I want a perfect simulation, rather something very simple to maintain. When I add a new material in an xml-file it's nice if I can just give it some values (like restitution, elasticity, hardness etc) and have everything "just work" rather than a table where all materials will need to have entries changed if another one is added. Very good answer though, I'll probably go with something like this! –  Mikael Högström Nov 17 '12 at 15:04
    
@MikaelHögström, a brick wall is fairly elastic relative to sand. Unless you're thinking about forces on the order of driving a car into it, you can probably assume it won't take damage. –  Peter Taylor Nov 17 '12 at 16:22
    
Good point :) I ended up going with a solution based on this, thanks a lot for your help! –  Mikael Högström Nov 19 '12 at 22:03
add comment

BulletPhysics seems to just multiply the restitution factors. This might not be a universal solution, but it satisfies the "everything just works" approach when adding new materials.

share|improve this answer
    
Seems a bit weird to me but thanks for the info! I guess you would have to set the restitution factors a bit higher then –  Mikael Högström Nov 20 '12 at 19:37
add comment

I personally think that taking the largest one make the most sense: (throwing a bouncy ball at a brick bounces even though a brick has no restitution to speak of), but if you have a game where you need to model complex bouncy interactions you could store a "material" per body and build up a materialA vs. materialB lookup table.

share|improve this answer
    
Hmm yeah I guess in that case it makes sense... It raises some problems though, a ball which is very bouncy will bounce exactly the same whether it bounces on a brick wall or on, say, soft sand. Table version seems like a possible solution I guess... –  Mikael Högström Nov 16 '12 at 23:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.