//override the default global value of a parameter (such as ERP or CFM), optionally provide the axis (0..5). //If no axis is provided, it uses the default axis for this constraint. public override void setParam( btConstraintParams num, double value, int axis = -1 ) { if( ( axis >= 0 ) && ( axis < 3 ) ) { switch( num ) { case btConstraintParams.BT_CONSTRAINT_STOP_ERP: m_linearLimits.m_stopERP[axis] = value; m_flags |= bt6DofFlagsIndexed.BT_6DOF_FLAGS_ERP_STOP2[axis]; break; case btConstraintParams.BT_CONSTRAINT_STOP_CFM: m_linearLimits.m_stopCFM[axis] = value; m_flags |= bt6DofFlagsIndexed.BT_6DOF_FLAGS_CFM_STOP2[axis]; break; case btConstraintParams.BT_CONSTRAINT_ERP: m_linearLimits.m_motorERP[axis] = value; m_flags |= bt6DofFlagsIndexed.BT_6DOF_FLAGS_ERP_MOTO2[axis]; break; case btConstraintParams.BT_CONSTRAINT_CFM: m_linearLimits.m_motorCFM[axis] = value; m_flags |= bt6DofFlagsIndexed.BT_6DOF_FLAGS_CFM_MOTO2[axis]; break; default: btAssertConstrParams( false ); break; } } else if( ( axis >= 3 ) && ( axis < 6 ) ) { switch( num ) { case btConstraintParams.BT_CONSTRAINT_STOP_ERP: m_angularLimits[axis - 3].m_stopERP = value; m_flags |= bt6DofFlagsIndexed.BT_6DOF_FLAGS_ERP_STOP2[axis]; break; case btConstraintParams.BT_CONSTRAINT_STOP_CFM: m_angularLimits[axis - 3].m_stopCFM = value; m_flags |= bt6DofFlagsIndexed.BT_6DOF_FLAGS_CFM_STOP2[axis]; break; case btConstraintParams.BT_CONSTRAINT_ERP: m_angularLimits[axis - 3].m_motorERP = value; m_flags |= bt6DofFlagsIndexed.BT_6DOF_FLAGS_ERP_MOTO2[axis]; break; case btConstraintParams.BT_CONSTRAINT_CFM: m_angularLimits[axis - 3].m_motorCFM = value; m_flags |= bt6DofFlagsIndexed.BT_6DOF_FLAGS_CFM_MOTO2[axis]; break; default: btAssertConstrParams( false ); break; } } else { btAssertConstrParams( false ); } }
//return the local value of parameter public override double getParam( btConstraintParams num, int axis = -1 ) { double retVal = 0; if( ( axis >= 0 ) && ( axis < 3 ) ) { switch( num ) { case btConstraintParams.BT_CONSTRAINT_STOP_ERP: btAssertConstrParams( ( m_flags & ( bt6DofFlagsIndexed.BT_6DOF_FLAGS_ERP_STOP2[axis] ) ) != 0 ); retVal = m_linearLimits.m_stopERP[axis]; break; case btConstraintParams.BT_CONSTRAINT_STOP_CFM: btAssertConstrParams( ( m_flags & ( bt6DofFlagsIndexed.BT_6DOF_FLAGS_CFM_STOP2[axis] ) ) != 0 ); retVal = m_linearLimits.m_stopCFM[axis]; break; case btConstraintParams.BT_CONSTRAINT_ERP: btAssertConstrParams( ( m_flags & ( bt6DofFlagsIndexed.BT_6DOF_FLAGS_ERP_MOTO2[axis] ) ) != 0 ); retVal = m_linearLimits.m_motorERP[axis]; break; case btConstraintParams.BT_CONSTRAINT_CFM: btAssertConstrParams( ( m_flags & ( bt6DofFlagsIndexed.BT_6DOF_FLAGS_CFM_MOTO2[axis] ) ) != 0 ); retVal = m_linearLimits.m_motorCFM[axis]; break; default: btAssertConstrParams( false ); break; } } else if( ( axis >= 3 ) && ( axis < 6 ) ) { switch( num ) { case btConstraintParams.BT_CONSTRAINT_STOP_ERP: btAssertConstrParams( ( m_flags & ( bt6DofFlagsIndexed.BT_6DOF_FLAGS_ERP_STOP2[axis] ) ) != 0 ); retVal = m_angularLimits[axis - 3].m_stopERP; break; case btConstraintParams.BT_CONSTRAINT_STOP_CFM: btAssertConstrParams( ( m_flags & ( bt6DofFlagsIndexed.BT_6DOF_FLAGS_CFM_STOP2[axis] ) ) != 0 ); retVal = m_angularLimits[axis - 3].m_stopCFM; break; case btConstraintParams.BT_CONSTRAINT_ERP: btAssertConstrParams( ( m_flags & ( bt6DofFlagsIndexed.BT_6DOF_FLAGS_ERP_MOTO2[axis] ) ) != 0 ); retVal = m_angularLimits[axis - 3].m_motorERP; break; case btConstraintParams.BT_CONSTRAINT_CFM: btAssertConstrParams( ( m_flags & ( bt6DofFlagsIndexed.BT_6DOF_FLAGS_CFM_MOTO2[axis] ) ) != 0 ); retVal = m_angularLimits[axis - 3].m_motorCFM; break; default: btAssertConstrParams( false ); break; } } else { btAssertConstrParams( false ); } return retVal; }
///override the default global value of a parameter (such as ERP or CFM), optionally provide the axis (0..5). ///If no axis is provided, it uses the default axis for this constraint. public override void setParam( btConstraintParams num, double value, int axis = -1 ) { if( axis != -1 ) { btAssertConstrParams( false ); } else { switch( num ) { case btConstraintParams.BT_CONSTRAINT_ERP: case btConstraintParams.BT_CONSTRAINT_STOP_ERP: m_erp = value; m_flags |= btPoint2PointFlags.BT_P2P_FLAGS_ERP; break; case btConstraintParams.BT_CONSTRAINT_CFM: case btConstraintParams.BT_CONSTRAINT_STOP_CFM: m_cfm = value; m_flags |= btPoint2PointFlags.BT_P2P_FLAGS_CFM; break; default: btAssertConstrParams( false ); break; } } }
///return the local value of parameter public override double getParam( btConstraintParams num, int axis = -1 ) { double retVal = ( btScalar.SIMD_INFINITY ); if( axis != -1 ) { btAssertConstrParams( false ); } else { switch( num ) { case btConstraintParams.BT_CONSTRAINT_ERP: case btConstraintParams.BT_CONSTRAINT_STOP_ERP: btAssertConstrParams( ( m_flags & btPoint2PointFlags.BT_P2P_FLAGS_ERP ) != 0 ); retVal = m_erp; break; case btConstraintParams.BT_CONSTRAINT_CFM: case btConstraintParams.BT_CONSTRAINT_STOP_CFM: btAssertConstrParams( ( m_flags & btPoint2PointFlags.BT_P2P_FLAGS_CFM ) != 0 ); retVal = m_cfm; break; default: btAssertConstrParams( false ); break; } } return retVal; }
///override the default global value of a parameter (such as ERP or CFM), optionally provide the axis (0..5). ///If no axis is provided, it uses the default axis for this constraint. public override void setParam( btConstraintParams num, double value, int axis ) { switch( num ) { case btConstraintParams.BT_CONSTRAINT_STOP_ERP: if( axis < 1 ) { m_softnessLimLin = value; m_flags |= btSliderFlags.BT_SLIDER_FLAGS_ERP_LIMLIN; } else if( axis < 3 ) { m_softnessOrthoLin = value; m_flags |= btSliderFlags.BT_SLIDER_FLAGS_ERP_ORTLIN; } else if( axis == 3 ) { m_softnessLimAng = value; m_flags |= btSliderFlags.BT_SLIDER_FLAGS_ERP_LIMANG; } else if( axis < 6 ) { m_softnessOrthoAng = value; m_flags |= btSliderFlags.BT_SLIDER_FLAGS_ERP_ORTANG; } else { btAssertConstrParams( false ); } break; case btConstraintParams.BT_CONSTRAINT_CFM: if( axis < 1 ) { m_cfmDirLin = value; m_flags |= btSliderFlags.BT_SLIDER_FLAGS_CFM_DIRLIN; } else if( axis == 3 ) { m_cfmDirAng = value; m_flags |= btSliderFlags.BT_SLIDER_FLAGS_CFM_DIRANG; } else { btAssertConstrParams( false ); } break; case btConstraintParams.BT_CONSTRAINT_STOP_CFM: if( axis < 1 ) { m_cfmLimLin = value; m_flags |= btSliderFlags.BT_SLIDER_FLAGS_CFM_LIMLIN; } else if( axis < 3 ) { m_cfmOrthoLin = value; m_flags |= btSliderFlags.BT_SLIDER_FLAGS_CFM_ORTLIN; } else if( axis == 3 ) { m_cfmLimAng = value; m_flags |= btSliderFlags.BT_SLIDER_FLAGS_CFM_LIMANG; } else if( axis < 6 ) { m_cfmOrthoAng = value; m_flags |= btSliderFlags.BT_SLIDER_FLAGS_CFM_ORTANG; } else { btAssertConstrParams( false ); } break; } }
///return the local value of parameter public override double getParam( btConstraintParams num, int axis = -1 ) { double retVal = 0; if( ( axis == -1 ) || ( axis == 5 ) ) { switch( num ) { case btConstraintParams.BT_CONSTRAINT_STOP_ERP: btAssertConstrParams( ( m_flags & btHingeFlags.BT_HINGE_FLAGS_ERP_STOP ) != 0 ); retVal = m_stopERP; break; case btConstraintParams.BT_CONSTRAINT_STOP_CFM: btAssertConstrParams( ( m_flags & btHingeFlags.BT_HINGE_FLAGS_CFM_STOP ) != 0 ); retVal = m_stopCFM; break; case btConstraintParams.BT_CONSTRAINT_CFM: btAssertConstrParams( ( m_flags & btHingeFlags.BT_HINGE_FLAGS_CFM_NORM ) != 0 ); retVal = m_normalCFM; break; case btConstraintParams.BT_CONSTRAINT_ERP: btAssertConstrParams( ( m_flags & btHingeFlags.BT_HINGE_FLAGS_ERP_NORM ) != 0 ); retVal = m_normalERP; break; default: btAssertConstrParams( false ); break; } } else { btAssertConstrParams( false ); } return retVal; }
///return the local value of parameter public override double getParam( btConstraintParams num, int axis ) { double retVal = ( btScalar.BT_LARGE_FLOAT ); switch( num ) { case btConstraintParams.BT_CONSTRAINT_STOP_ERP: if( axis < 1 ) { btAssertConstrParams( ( m_flags & btSliderFlags.BT_SLIDER_FLAGS_ERP_LIMLIN ) != 0 ); retVal = m_softnessLimLin; } else if( axis < 3 ) { btAssertConstrParams( ( m_flags & btSliderFlags.BT_SLIDER_FLAGS_ERP_ORTLIN ) != 0 ); retVal = m_softnessOrthoLin; } else if( axis == 3 ) { btAssertConstrParams( ( m_flags & btSliderFlags.BT_SLIDER_FLAGS_ERP_LIMANG ) != 0 ); retVal = m_softnessLimAng; } else if( axis < 6 ) { btAssertConstrParams( ( m_flags & btSliderFlags.BT_SLIDER_FLAGS_ERP_ORTANG ) != 0 ); retVal = m_softnessOrthoAng; } else { btAssertConstrParams( false ); } break; case btConstraintParams.BT_CONSTRAINT_CFM: if( axis < 1 ) { btAssertConstrParams( ( m_flags & btSliderFlags.BT_SLIDER_FLAGS_CFM_DIRLIN ) != 0 ); retVal = m_cfmDirLin; } else if( axis == 3 ) { btAssertConstrParams( ( m_flags & btSliderFlags.BT_SLIDER_FLAGS_CFM_DIRANG ) != 0 ); retVal = m_cfmDirAng; } else { btAssertConstrParams( false ); } break; case btConstraintParams.BT_CONSTRAINT_STOP_CFM: if( axis < 1 ) { btAssertConstrParams( ( m_flags & btSliderFlags.BT_SLIDER_FLAGS_CFM_LIMLIN ) != 0 ); retVal = m_cfmLimLin; } else if( axis < 3 ) { btAssertConstrParams( ( m_flags & btSliderFlags.BT_SLIDER_FLAGS_CFM_ORTLIN ) != 0 ); retVal = m_cfmOrthoLin; } else if( axis == 3 ) { btAssertConstrParams( ( m_flags & btSliderFlags.BT_SLIDER_FLAGS_CFM_LIMANG ) != 0 ); retVal = m_cfmLimAng; } else if( axis < 6 ) { btAssertConstrParams( ( m_flags & btSliderFlags.BT_SLIDER_FLAGS_CFM_ORTANG ) != 0 ); retVal = m_cfmOrthoAng; } else { btAssertConstrParams( false ); } break; } return retVal; }
///return the local value of parameter public abstract double getParam( btConstraintParams num, int axis = -1 );
///override the default global value of a parameter (such as ERP or CFM), optionally provide the axis (0..5). ///If no axis is provided, it uses the default axis for this constraint. public abstract void setParam( btConstraintParams num, double value, int axis = -1 );
///return the local value of parameter public override double getParam( btConstraintParams num, int axis ) { double retVal = 0; switch( num ) { case btConstraintParams.BT_CONSTRAINT_ERP: case btConstraintParams.BT_CONSTRAINT_STOP_ERP: if( ( axis >= 0 ) && ( axis < 3 ) ) { btAssertConstrParams( ( m_flags & btConeTwistFlags.BT_CONETWIST_FLAGS_LIN_ERP ) != 0 ); retVal = m_linERP; } else if( ( axis >= 3 ) && ( axis < 6 ) ) { retVal = m_biasFactor; } else { btAssertConstrParams( false ); } break; case btConstraintParams.BT_CONSTRAINT_CFM: case btConstraintParams.BT_CONSTRAINT_STOP_CFM: if( ( axis >= 0 ) && ( axis < 3 ) ) { btAssertConstrParams( ( m_flags & btConeTwistFlags.BT_CONETWIST_FLAGS_LIN_CFM ) != 0 ); retVal = m_linCFM; } else if( ( axis >= 3 ) && ( axis < 6 ) ) { btAssertConstrParams( ( m_flags & btConeTwistFlags.BT_CONETWIST_FLAGS_ANG_CFM ) != 0 ); retVal = m_angCFM; } else { btAssertConstrParams( false ); } break; default: btAssertConstrParams( false ); break; } return retVal; }
///override the default global value of a parameter (such as ERP or CFM), optionally provide the axis (0..5). ///If no axis is provided, it uses the default axis for this constraint. public override void setParam( btConstraintParams num, double value, int axis = -1 ) { switch( num ) { case btConstraintParams.BT_CONSTRAINT_ERP: case btConstraintParams.BT_CONSTRAINT_STOP_ERP: if( ( axis >= 0 ) && ( axis < 3 ) ) { m_linERP = value; m_flags |= btConeTwistFlags.BT_CONETWIST_FLAGS_LIN_ERP; } else { m_biasFactor = value; } break; case btConstraintParams.BT_CONSTRAINT_CFM: case btConstraintParams.BT_CONSTRAINT_STOP_CFM: if( ( axis >= 0 ) && ( axis < 3 ) ) { m_linCFM = value; m_flags |= btConeTwistFlags.BT_CONETWIST_FLAGS_LIN_CFM; } else { m_angCFM = value; m_flags |= btConeTwistFlags.BT_CONETWIST_FLAGS_ANG_CFM; } break; default: btAssertConstrParams( false ); break; } }