Where should I dynamically set the materials, restitution coefficients and friction coefficients for the correct collision response between two objects?
Is there a particular method I should overload? Does the 'MaterialManager' class come into play?
Where do I set the materials and coefficients for response?
-
- Posts: 249
- Joined: Wed Nov 17, 2010 1:49 pm
Re: Where do I set the materials and coefficients for respon
The kinetic friction, static friction, and bounciness of the two objects are blended using the MaterialManager.MaterialBlender. This defaults to the MaterialManager.DefaultMaterialBlender function which multiplies the values together. The MaterialManager.MaterialBlender delegate can be changed.
For special cases between certain materials, the MaterialBlender.MaterialInteractions can be used. This is a dictionary which associates material pairs with arbitrary MaterialBlender delegates. If a pair is defined in the dictionary, the custom delegate will be used instead of the catch-all MaterialManager.MaterialBlender.
For special cases between certain materials, the MaterialBlender.MaterialInteractions can be used. This is a dictionary which associates material pairs with arbitrary MaterialBlender delegates. If a pair is defined in the dictionary, the custom delegate will be used instead of the catch-all MaterialManager.MaterialBlender.
-
- Posts: 249
- Joined: Wed Nov 17, 2010 1:49 pm
Re: Where do I set the materials and coefficients for respon
EDIT:
I think I've got it now
I think I've got it now

Code: Select all
MaterialBlender woodOnWood = delegate(Material a, Material b, out InteractionProperties properties)
{
properties.Bounciness = a.Bounciness;
properties.KineticFriction = 0.25f;
properties.StaticFriction = 0.5f;
};
Material wood = new Material();
wood.Bounciness = 0.603f;
MaterialManager.MaterialInteractions.Add(new MaterialPair(wood, wood), woodOnWood);