Ejemplo n.º 1
0
int Physics::levelContactProcess( const NewtonMaterial* p_material, const NewtonContact* /*p_contact*/ )
{
    // handle level submaterials
    unsigned int materialType = static_cast< unsigned int >( NewtonMaterialGetContactFaceAttribute( p_material ) );
    switch ( materialType )
    {
        case Physics::MAT_DEFAULT:
            NewtonMaterialSetContactElasticity( p_material, 0.3f );
            NewtonMaterialSetContactStaticFrictionCoef( p_material, 0.6f, 0 );
            NewtonMaterialSetContactKineticFrictionCoef( p_material, 0.3f, 0 );
            break;

        case Physics::MAT_WOOD:

            NewtonMaterialSetContactElasticity( p_material, 0.5f );
            NewtonMaterialSetContactStaticFrictionCoef( p_material, 0.6f, 0 );
            NewtonMaterialSetContactKineticFrictionCoef( p_material, 0.4f, 0 );
            break;

        case Physics::MAT_STONE:

            NewtonMaterialSetContactElasticity( p_material, 0.4f );
            NewtonMaterialSetContactStaticFrictionCoef( p_material, 0.55f, 0 );
            NewtonMaterialSetContactKineticFrictionCoef( p_material, 0.35f, 0 );
            break;

        case Physics::MAT_METALL:

            NewtonMaterialSetContactElasticity( p_material, 0.6f );
            NewtonMaterialSetContactStaticFrictionCoef( p_material, 0.5f, 0 );
            NewtonMaterialSetContactKineticFrictionCoef( p_material, 0.4f, 0 );
            break;

        case Physics::MAT_GRASS:

            NewtonMaterialSetContactElasticity( p_material, 0.4f );
            NewtonMaterialSetContactStaticFrictionCoef( p_material, 0.8f, 0 );
            NewtonMaterialSetContactKineticFrictionCoef( p_material, 0.6f, 0 );
            break;

        case Physics::MAT_WALL:

            NewtonMaterialSetContactElasticity( p_material, 0.8f );
            NewtonMaterialSetContactStaticFrictionCoef( p_material, 0.1f, 0 );
            NewtonMaterialSetContactKineticFrictionCoef( p_material, 0.1f, 0 );
            break;

        // simply return 0 for non-colliding pairs
        case Physics::MAT_NOCOL:
            return 0;
            break;

        default:
            ;
    }

    return 1;
}
Ejemplo n.º 2
0
void Material::SetContactStaticFrictionCoef  ( dFloat coef, int index)
{
    NewtonMaterialSetContactStaticFrictionCoef( m_material, coef, index );
}
Ejemplo n.º 3
0
 virtual void setStaticFrictionCoefficient(Math::Real _coefficent, bool _primary = true)
 {
     NewtonMaterialSetContactStaticFrictionCoef(m_pMaterial, _coefficent, _primary ? 0 : 1);
 }