' ==============================================================================================================
' ============================================ PREHIT CODES ===================================================
''''''''''''''''''''''''''''''''''''''''''''Left Flipper Prehit Code'''''''''''''''''''''''''''''''''''''''
Sub LeftFlipper_prehit()
OnPreHitFlipperSettings(LeftFlipperExt)
'Local Variable to have less time consuming.
BallSpeed = Clng(xBAM.Ball.Speed)
LFBallVSpeed = Clng(LeftFlipperExt.BallVSpeed)
LFContactPoint = Round(LeftFlipperExt.ContactPoint,2)
LFAngleDiff = Round(LeftFlipperExt.angleDiff,2)
'Bouncing / KineticSensivity / LiveCatch Code
If LFAngleDiff > ( SwingAngle + ( LiveCatchDifficulty / 50 ) ) then LeftFlipperExt.SetMaterial 0, 1, FlipperStaticFriction, FlipperKineticFriction : End If
If ( LFAngleDiff => SwingAngle - 0.05 and LFAngleDiff =< ( SwingAngle + ( LiveCatchDifficulty / 50 ) ) ) or LeftFlipperExt.IsSolenoidOn = False then
If LFBallVSpeed <= ( BallKineticSensivity * 10 ) Then FlipperElasticCoef = 1.1 : End If
If LFBallVSpeed > ( BallKineticSensivity * 10 ) and LFBallVSpeed <= BouncingFallOffThreshold Then FlipperElasticCoef = FlipperBouncingCoeff * ( 1 - ( FlipperBouncingFallOff * ( LFBallVSpeed / BouncingFallOffThreshold ) ) ) : End If
If LFBallVSpeed > ( BallKineticSensivity * 10 ) and LFBallVSpeed > BouncingFallOffThreshold Then FlipperElasticCoef = FlipperBouncingCoeff * ( 1 - FlipperBouncingFallOff ) : End If
LeftFlipperExt.SetMaterial FlipperElasticCoef, 1, FlipperStaticFriction, FlipperKineticFriction
If BallSpeed < 2 Then Exit Sub
End If
'Anti ball passtrhough over Flipper Drop Catch + Shake Effect. ( Avoid FP Engine Issue )
If LFContactPoint > 0 and LeftFlipperExt.IsSolenoidOn = False and LFAngleDiff < 5 and LeftFlipperExt.Hit = True and LFBallVSpeed > 200 then
LeftFlipper.SolenoidOn
LeftFlipper.SolenoidOff
End If
'Code for Power Ramp Up and EOS
LFRampUpOmega = CLng( ( ( ( 100^RampUpLinearity / CoilRampUp^RampUpLinearity ) * LFAngleDiff^RampUpLinearity ) / 100^RampUpLinearity ) * LFOmega ) + ( ( ( LFOmega / 100 ) * CoilRampStartPower ) - ( ( ( LFOmega / 100 ) * CoilRampStartPower ) * ( LFAngleDiff^RampUpLinearity / CoilRampUp^RampUpLinearity ) ) )
LFOmega = Clng( BaseOmega - (LFContactPoint * ((BaseOmega - TipOmega)/1.2)))
If LFContactPoint > 0 and LFAngleDiff <= CoilRampUp and LeftFlipperExt.Hit = True then LeftFlipperExt.Omega = LFRampUpOmega Else LeftFlipperExt.Omega = LFOmega : End If
If LFContactPoint > 0 and LFAngleDiff < SwingAngle - EOSAngle and LFAngleDiff > CoilRampUp then LeftFlipperExt.Omega = LFOmega : End If
If LFContactPoint > 0 and LFAngleDiff => SwingAngle - EOSAngle then LeftFlipperExt.Omega = LFOmega * EOSTorque : End If
'Code to apply Velocity correction when flipper "On"
LFMoveFriction = FlipperKineticFriction - (( LFContactPoint * FlipperKineticFriction ) * RollingEffect )
If LeftFlipperExt.IsSolenoidOn = True and LFAngleDiff < SwingAngle - 0.05 and LFContactPoint > 0 then 'and LFContactPoint < 1.2 then
LeftFlipperExt.SetMaterial 0, 1, FlipperStaticFriction, LFMoveFriction
xBAM.ball.SetOmega -0.1,-0.1,-0.1
End If
'Ball Spinning stop on hit
If OverspinDeleter = 1 and LeftFlipperExt.Hit and LFContactPoint < 1 and LeftFlipperExt.IsSolenoidOn = True and LFBallVSpeed > 50 and LFAngleDiff = SwingAngle then
xBAM.ball.SetOmega -0.1,-0.1,-0.1
LeftFlipperExt.SetMaterial FlipperElasticCoef, 1, FlipperStaticFriction, LFMoveFriction
End If
'AddDebugText "Hit" & LeftFlipperExt.Hit
'AddDebugText "ContactPointL" & LFContactPoint
'AddDebugText "ANGLER" & LeftFlipperExt.AngleDiff
'AddDebugText "LFBallVSpeed" & LFBallVSpeed
'AddDebugText "RampUpOmega" & LFRampUpOmega
'AddDebugText "Omega" & LeftFlipperExt.Omega
'AddDebugText "BallSpeed" & xBAM.Ball.Speed
End Sub
''''''''''''''''''''''''''''''''''''''''''''Left Flipper 2 Prehit Code'''''''''''''''''''''''''''''''''''''''
Sub LeftFlipper2_prehit()
OnPreHitFlipperSettings(LeftFlipper2Ext)
'Local Variable to have less time consuming.
BallSpeed = Clng(xBAM.Ball.Speed)
LF2BallVSpeed = Clng(LeftFlipper2Ext.BallVSpeed)
LF2ContactPoint = Round(LeftFlipper2Ext.ContactPoint,2)
LF2AngleDiff = Round(LeftFlipper2Ext.angleDiff,2)
'Bouncing / KineticSensivity / LiveCatch Code
If LF2AngleDiff > ( SwingAngleLF2 + ( LiveCatchDifficulty / 50 ) ) then LeftFlipper2Ext.SetMaterial 0, 1, LF2StaticFriction, LF2KineticFriction : End If
If ( LF2AngleDiff => SwingAngleLF2 - 0.05 and LF2AngleDiff =< ( SwingAngleLF2 + ( LiveCatchDifficulty / 50 ) ) ) or LeftFlipper2Ext.IsSolenoidOn = False then
If LF2BallVSpeed <= ( BallKineticSensivity * 10 ) Then FlipperElasticCoef = 1.1 : End If
If LF2BallVSpeed > ( BallKineticSensivity * 10 ) and LF2BallVSpeed <= BouncingFallOffThreshold Then FlipperElasticCoef = FlipperBouncingCoeff * ( 1 - ( FlipperBouncingFallOff * ( LF2BallVSpeed / BouncingFallOffThreshold ) ) ) : End If
If LF2BallVSpeed > ( BallKineticSensivity * 10 ) and LF2BallVSpeed > BouncingFallOffThreshold Then FlipperElasticCoef = FlipperBouncingCoeff * ( 1 - FlipperBouncingFallOff ) : End If
LeftFlipper2Ext.SetMaterial FlipperElasticCoef, 1, LF2StaticFriction, LF2KineticFriction
If BallSpeed < 2 Then Exit Sub
End If
'Anti ball passtrhough over Flipper Drop Catch + Shake Effect. ( Avoid FP Engine Issue )
If LF2ContactPoint > 0 and LeftFlipper2Ext.IsSolenoidOn = False and LF2AngleDiff < 5 and LeftFlipper2Ext.Hit = True and LF2BallVSpeed > 200 then
LeftFlipper2.SolenoidOn
LeftFlipper2.SolenoidOff
End If
'Code for "Anti Backside shoot". This is to prevent ball kicking by the backside of flipper like a shoot, mainly to prevent ball drain from upper flipper with huge velocity
If LF2ContactPoint = 0 and LeftFlipper2Ext.IsSolenoidOn = False and LF2AngleDiff < SwingAngleLF2 - 1 and BallSpeed > 20 then
LeftFlipper2.SolenoidOn
LeftFlipper2.SolenoidOff
End If
'Code for Power Ramp Up and EOS
LF2RampUpOmega = ( ( ( ( 100^RampUpLinearity / CoilRampUp^RampUpLinearity ) * LF2AngleDiff^RampUpLinearity ) / 100^RampUpLinearity ) * LF2Omega ) + ( ( ( LF2Omega / 100 ) * CoilRampStartPower ) - ( ( ( LF2Omega / 100 ) * CoilRampStartPower ) * ( LF2AngleDiff^RampUpLinearity / CoilRampUp^RampUpLinearity ) ) )
LF2Omega = ( BaseOmega - (LF2ContactPoint * ((BaseOmega - TipOmega)/1.2)))
If LF2ContactPoint > 0 and LF2AngleDiff <= CoilRampUp and LeftFlipper2Ext.Hit = True then LeftFlipper2Ext.Omega = LF2RampUpOmega Else LeftFlipper2Ext.Omega = LF2Omega : End If
If LF2ContactPoint > 0 and LF2AngleDiff < SwingAngleLF2 - EOSAngle and LF2AngleDiff > CoilRampUp then LeftFlipper2Ext.Omega = LF2Omega : End If
If LF2ContactPoint > 0 and LF2AngleDiff => SwingAngleLF2 - EOSAngle then LeftFlipper2Ext.Omega = LF2Omega * EOSTorque : End If
'Code to apply Velocity correction when flipper "On"
LF2MoveFriction = LF2KineticFriction - (( LF2ContactPoint * LF2KineticFriction ) * RollingEffectLF2 )
If LeftFlipper2Ext.IsSolenoidOn = True and LF2AngleDiff < SwingAngleLF2 - 0.05 and LF2ContactPoint > 0 then' and LF2ContactPoint < 1.2 then
LeftFlipper2Ext.SetMaterial 0, 1, LF2StaticFriction, LF2MoveFriction
xBAM.ball.SetOmega -0.1,-0.1,-0.1
End If
'Ball Spinning stop on hit
If OverspinDeleter = 1 and LeftFlipper2Ext.Hit and LF2ContactPoint < 1 and LeftFlipper2Ext.IsSolenoidOn = True and LF2BallVSpeed > 50 then
xBAM.ball.SetOmega -0.1,-0.1,-0.1
LeftFlipper2Ext.SetMaterial FlipperElasticCoef, 1, LF2StaticFriction, LF2MoveFriction
End If
End Sub
''''''''''''''''''''''''''''''''''''''''''''Left Flipper 3 Prehit Code'''''''''''''''''''''''''''''''''''''''
Sub LeftFlipper3_prehit()
OnPreHitFlipperSettings(LeftFlipper3Ext)
'Local Variable to have less time consuming.
BallSpeed = Clng(xBAM.Ball.Speed)
LF3BallVSpeed = Clng(LeftFlipper3Ext.BallVSpeed)
LF3ContactPoint = Round(LeftFlipper3Ext.ContactPoint,2)
LF3AngleDiff = Round(LeftFlipper3Ext.angleDiff,2)
'Bouncing / KineticSensivity / LiveCatch Code
If LF3AngleDiff > ( SwingAngleLF3 + ( LiveCatchDifficulty / 50 ) ) then LeftFlipper3Ext.SetMaterial 0, 1, LF3StaticFriction, LF3KineticFriction : End If
If ( LF3AngleDiff => SwingAngleLF3 - 0.05 and LF3AngleDiff =< ( SwingAngleLF3 + ( LiveCatchDifficulty / 50 ) ) ) or LeftFlipper3Ext.IsSolenoidOn = False then
If LF3BallVSpeed <= ( BallKineticSensivity * 10 ) Then FlipperElasticCoef = 1.1 : End If
If LF3BallVSpeed > ( BallKineticSensivity * 10 ) and LF3BallVSpeed <= BouncingFallOffThreshold Then FlipperElasticCoef = FlipperBouncingCoeff * ( 1 - ( FlipperBouncingFallOff * ( LF3BallVSpeed / BouncingFallOffThreshold ) ) ) : End If
If LF3BallVSpeed > ( BallKineticSensivity * 10 ) and LF3BallVSpeed > BouncingFallOffThreshold Then FlipperElasticCoef = FlipperBouncingCoeff * ( 1 - FlipperBouncingFallOff ) : End If
LeftFlipper3Ext.SetMaterial FlipperElasticCoef, 1, LF3StaticFriction, LF3KineticFriction
If BallSpeed < 2 Then Exit Sub
End If
'Anti ball passtrhough over Flipper Drop Catch + Shake Effect. ( Avoid FP Engine Issue )
If LF3ContactPoint > 0 and LeftFlipper3Ext.IsSolenoidOn = False and LF3AngleDiff < 5 and LeftFlipper3Ext.Hit = True and LF3BallVSpeed > 200 then
LeftFlipper3.SolenoidOn
LeftFlipper3.SolenoidOff
End If
'Code for "Anti Backside shoot". This is to prevent ball kicking by the backside of flipper like a shoot, mainly to prevent ball drain from upper flipper with huge velocity
If LF3ContactPoint = 0 and LeftFlipper3Ext.IsSolenoidOn = False and LF3AngleDiff < SwingAngleLF3 - 1 and BallSpeed > 20 then
LeftFlipper3.SolenoidOn
LeftFlipper3.SolenoidOff
End If
'Code for Power Ramp Up and EOS
LF3RampUpOmega = ( ( ( ( 100^RampUpLinearity / CoilRampUp^RampUpLinearity ) * LF3AngleDiff^RampUpLinearity ) / 100^RampUpLinearity ) * LF3Omega ) + ( ( ( LF3Omega / 100 ) * CoilRampStartPower ) - ( ( ( LF3Omega / 100 ) * CoilRampStartPower ) * ( LF3AngleDiff^RampUpLinearity / CoilRampUp^RampUpLinearity ) ) )
LF3Omega = ( BaseOmega - (LF3ContactPoint * ((BaseOmega - TipOmega)/1.2)))
If LF3ContactPoint > 0 and LF3AngleDiff <= CoilRampUp and LeftFlipper3Ext.Hit = True then LeftFlipper3Ext.Omega = LF3RampUpOmega Else LeftFlipper3Ext.Omega = LF3Omega : End If
If LF3ContactPoint > 0 and LF3AngleDiff < SwingAngleLF3 - EOSAngle and LF3AngleDiff > CoilRampUp then LeftFlipper3Ext.Omega = LF3Omega : End If
If LF3ContactPoint > 0 and LF3AngleDiff => SwingAngleLF3 - EOSAngle then LeftFlipper3Ext.Omega = LF3Omega * EOSTorque : End If
'Code to apply Velocity correction when flipper "On"
LF3MoveFriction = LF3KineticFriction - (( LF3ContactPoint * LF3KineticFriction ) * RollingEffectLF3 )
If LeftFlipper3Ext.IsSolenoidOn = True and LF3AngleDiff < SwingAngleLF3 - 0.05 and LF3ContactPoint > 0 then' and LF3ContactPoint < 1.2 then
LeftFlipper3Ext.SetMaterial 0, 1, LF3StaticFriction, LF3MoveFriction
xBAM.ball.SetOmega -0.1,-0.1,-0.1
End If
'Ball Spinning stop on hit
If OverspinDeleter = 1 and LeftFlipper3Ext.Hit and LF3ContactPoint < 1 and LeftFlipper3Ext.IsSolenoidOn = True and LF3BallVSpeed > 50 then
xBAM.ball.SetOmega -0.1,-0.1,-0.1
LeftFlipper3Ext.SetMaterial FlipperElasticCoef, 1, LF3StaticFriction, LF3MoveFriction
End If
End Sub
''''''''''''''''''''''''''''''''''''''''''''Right Flipper Prehit Code'''''''''''''''''''''''''''''''''''''''
Sub RightFlipper_prehit()
OnPreHitFlipperSettings(RightFlipperExt)
'Local Variable to have less time consuming.
BallSpeed = Clng(xBAM.Ball.Speed)
RFBallVSpeed = Clng(RightFlipperExt.BallVSpeed)
RFContactPoint = Round(RightFlipperExt.ContactPoint,2)
RFAngleDiff = Round(RightFlipperExt.angleDiff,2)
'Bouncing / KineticSensivity / LiveCatch Code
If RFAngleDiff > ( SwingAngle + ( LiveCatchDifficulty / 50 ) ) then RightFlipperExt.SetMaterial 0, 1, FlipperStaticFriction, FlipperKineticFriction : End If
If ( RFAngleDiff => SwingAngle - 0.05 and RFAngleDiff =< ( SwingAngle + ( LiveCatchDifficulty / 50 ) ) ) or RightFlipperExt.IsSolenoidOn = False then
If RFBallVSpeed <= ( BallKineticSensivity * 10 ) Then FlipperElasticCoef = 1.1 : End If
If RFBallVSpeed > ( BallKineticSensivity * 10 ) and RFBallVSpeed <= BouncingFallOffThreshold Then FlipperElasticCoef = FlipperBouncingCoeff * ( 1 - ( FlipperBouncingFallOff * ( RFBallVSpeed / BouncingFallOffThreshold ) ) ) : End If
If RFBallVSpeed > ( BallKineticSensivity * 10 ) and RFBallVSpeed > BouncingFallOffThreshold Then FlipperElasticCoef = FlipperBouncingCoeff * ( 1 - FlipperBouncingFallOff ) : End If
RightFlipperExt.SetMaterial FlipperElasticCoef, 1, FlipperStaticFriction, FlipperKineticFriction
If BallSpeed < 2 Then Exit Sub
End If
'Anti ball passtrhough over Flipper Drop Catch + Shake Effect. ( Avoid FP Engine Issue )
If RFContactPoint > 0 and RightFlipperExt.IsSolenoidOn = False and RFAngleDiff < 5 and RightFlipperExt.Hit = True and RFBallVSpeed > 200 then
RightFlipper.SolenoidOn
RightFlipper.SolenoidOff
End If
'Code for Power Ramp Up and EOS
RFRampUpOmega = CLng( ( ( ( 100^RampUpLinearity / CoilRampUp^RampUpLinearity ) * RFAngleDiff^RampUpLinearity ) / 100^RampUpLinearity ) * RFOmega ) + ( ( ( RFOmega / 100 ) * CoilRampStartPower ) - ( ( ( RFOmega / 100 ) * CoilRampStartPower ) * ( RFAngleDiff^RampUpLinearity / CoilRampUp^RampUpLinearity ) ) )
RFOmega = Clng( BaseOmega - (RFContactPoint * ((BaseOmega - TipOmega)/1.2)))
If RFContactPoint > 0 and RFAngleDiff <= CoilRampUp and RightFlipperExt.Hit = True then RightFlipperExt.Omega = RFRampUpOmega Else RightFlipperExt.Omega = RFOmega : End If
If RFContactPoint > 0 and RFAngleDiff < SwingAngle - EOSAngle and RFAngleDiff > CoilRampUp then RightFlipperExt.Omega = RFOmega : End If
If RFContactPoint > 0 and RFAngleDiff => SwingAngle - EOSAngle then RightFlipperExt.Omega = RFOmega * EOSTorque : End If
'Code to apply Velocity correction when flipper "On"
RFMoveFriction = FlipperKineticFriction - (( RFContactPoint * FlipperKineticFriction ) * RollingEffect )
If RightFlipperExt.IsSolenoidOn = True and RFAngleDiff < SwingAngle - 0.05 and RFContactPoint > 0 then 'and RFContactPoint < 1.2 then
RightFlipperExt.SetMaterial 0, 1, FlipperStaticFriction, RFMoveFriction
xBAM.ball.SetOmega -0.1,0.1,0.1
End If
'Ball Spinning stop on hit
If OverspinDeleter = 1 and RightFlipperExt.Hit and RFContactPoint < 1 and RightFlipperExt.IsSolenoidOn = True and RFBallVSpeed > 50 and RFAngleDiff = SwingAngle then
xBAM.ball.SetOmega -0.1,0.1,0.1
RightFlipperExt.SetMaterial FlipperElasticCoef, 1, FlipperStaticFriction, RFMoveFriction
End If
'AddDebugText "ContactPointR" & RightFlipperExt.ContactPoint
'AddDebugText "ANGLER" & RightFlipperExt.AngleDiff
'AddDebugText "RF.BallVSpeed" & RightFlipperExt.BallVSpeed
'AddDebugText "PFTrajectoryCorrection= " & PFTrajectoryCorrection
End Sub
''''''''''''''''''''''''''''''''''''''''''''Right Flipper 2 Prehit Code'''''''''''''''''''''''''''''''''''''''
Sub RightFlipper2_prehit()
OnPreHitFlipperSettings(RightFlipper2Ext)
'Local Variable to have less time consuming.
BallSpeed = Clng(xBAM.Ball.Speed)
RF2BallVSpeed = Clng(RightFlipper2Ext.BallVSpeed)
RF2ContactPoint = Round(RightFlipper2Ext.ContactPoint,2)
RF2AngleDiff = Round(RightFlipper2Ext.angleDiff,2)
'Bouncing / KineticSensivity / LiveCatch Code
If RF2AngleDiff > ( SwingAngleRF2 + ( LiveCatchDifficulty / 50 ) ) then RightFlipper2Ext.SetMaterial 0, 1, RF2StaticFriction, RF2KineticFriction : End If
If ( RF2AngleDiff => SwingAngleRF2 - 0.05 and RF2AngleDiff =< ( SwingAngleRF2 + ( LiveCatchDifficulty / 50 ) ) ) or RightFlipper2Ext.IsSolenoidOn = False then
If RF2BallVSpeed <= ( BallKineticSensivity * 10 ) Then FlipperElasticCoef = 1.1 : End If
If RF2BallVSpeed > ( BallKineticSensivity * 10 ) and RF2BallVSpeed <= BouncingFallOffThreshold Then FlipperElasticCoef = FlipperBouncingCoeff * ( 1 - ( FlipperBouncingFallOff * ( RF2BallVSpeed / BouncingFallOffThreshold ) ) ) : End If
If RF2BallVSpeed > ( BallKineticSensivity * 10 ) and RF2BallVSpeed > BouncingFallOffThreshold Then FlipperElasticCoef = FlipperBouncingCoeff * ( 1 - FlipperBouncingFallOff ) : End If
RightFlipper2Ext.SetMaterial FlipperElasticCoef, 1, RF2StaticFriction, RF2KineticFriction
If BallSpeed < 2 Then Exit Sub
End If
'Anti ball passtrhough over Flipper Drop Catch + Shake Effect. ( Avoid FP Engine Issue )
If RF2ContactPoint > 0 and RightFlipper2Ext.IsSolenoidOn = False and RF2AngleDiff < 5 and RightFlipper2Ext.Hit = True and RF2BallVSpeed > 200 then
RightFlipper2.SolenoidOn
RightFlipper2.SolenoidOff
End If
'Code for "Anti Backside shoot". This is to prevent ball kicking by the backside of flipper like a shoot, mainly to prevent ball drain from upper flipper with huge velocity
If RF2ContactPoint = 0 and RightFlipper2Ext.IsSolenoidOn = False and RF2AngleDiff < SwingAngleRF2 - 1 and BallSpeed > 20 then
RightFlipper2.SolenoidOn
RightFlipper2.SolenoidOff
End If
'Code for Power Ramp Up and EOS
RF2RampUpOmega = ( ( ( ( 100^RampUpLinearity / CoilRampUp^RampUpLinearity ) * RF2AngleDiff^RampUpLinearity ) / 100^RampUpLinearity ) * RF2Omega ) + ( ( ( RF2Omega / 100 ) * CoilRampStartPower ) - ( ( ( RF2Omega / 100 ) * CoilRampStartPower ) * ( RF2AngleDiff^RampUpLinearity / CoilRampUp^RampUpLinearity ) ) )
RF2Omega = ( BaseOmega - (RF2ContactPoint * ((BaseOmega - TipOmega)/1.2)))
If RF2ContactPoint > 0 and RF2AngleDiff <= CoilRampUp and RightFlipper2Ext.Hit = True then RightFlipper2Ext.Omega = RF2RampUpOmega Else RightFlipper2Ext.Omega = RF2Omega : End If
If RF2ContactPoint > 0 and RF2AngleDiff < SwingAngleRF2 - EOSAngle and RF2AngleDiff > CoilRampUp then RightFlipper2Ext.Omega = RF2Omega : End If
If RF2ContactPoint > 0 and RF2AngleDiff => SwingAngleRF2 - EOSAngle then RightFlipper2Ext.Omega = RF2Omega * EOSTorque : End If
'Code to apply Velocity correction when flipper "On"
RF2MoveFriction = RF2KineticFriction - (( RF2ContactPoint * RF2KineticFriction ) * RollingEffectRF2 )
If RightFlipper2Ext.IsSolenoidOn = True and RF2AngleDiff < SwingAngleRF2 - 0.05 and RF2ContactPoint > 0 then' and RF2ContactPoint < 1.2 then
RightFlipper2Ext.SetMaterial 0, 1, RF2StaticFriction, RF2MoveFriction
xBAM.ball.SetOmega -0.1,0.1,0.1
End If
'Ball Spinning stop on hit
If OverspinDeleter = 1 and RightFlipper2Ext.Hit and RF2ContactPoint < 1 and RightFlipper2Ext.IsSolenoidOn = True and RF2BallVSpeed > 50 then
xBAM.ball.SetOmega -0.1,0.1,0.1
RightFlipper2Ext.SetMaterial FlipperElasticCoef, 1, RF2StaticFriction, RF2MoveFriction
End If
End Sub
''''''''''''''''''''''''''''''''''''''''''''Right Flipper 3 Prehit Code'''''''''''''''''''''''''''''''''''''''
Sub RightFlipper3_prehit()
OnPreHitFlipperSettings(RightFlipper3Ext)
'Local Variable to have less time consuming.
BallSpeed = Clng(xBAM.Ball.Speed)
RF3BallVSpeed = Clng(RightFlipper3Ext.BallVSpeed)
RF3ContactPoint = Round(RightFlipper3Ext.ContactPoint,2)
RF3AngleDiff = Round(RightFlipper3Ext.angleDiff,2)
'Bouncing / KineticSensivity / LiveCatch Code
If RF3AngleDiff > ( SwingAngleRF3 + ( LiveCatchDifficulty / 50 ) ) then RightFlipper3Ext.SetMaterial 0, 1, RF3StaticFriction, RF3KineticFriction : End If
If ( RF3AngleDiff => SwingAngleRF3 - 0.05 and RF3AngleDiff =< ( SwingAngleRF3 + ( LiveCatchDifficulty / 50 ) ) ) or RightFlipper3Ext.IsSolenoidOn = False then
If RF3BallVSpeed <= ( BallKineticSensivity * 10 ) Then FlipperElasticCoef = 1.1 : End If
If RF3BallVSpeed > ( BallKineticSensivity * 10 ) and RF3BallVSpeed <= BouncingFallOffThreshold Then FlipperElasticCoef = FlipperBouncingCoeff * ( 1 - ( FlipperBouncingFallOff * ( RF3BallVSpeed / BouncingFallOffThreshold ) ) ) : End If
If RF3BallVSpeed > ( BallKineticSensivity * 10 ) and RF3BallVSpeed > BouncingFallOffThreshold Then FlipperElasticCoef = FlipperBouncingCoeff * ( 1 - FlipperBouncingFallOff ) : End If
RightFlipper3Ext.SetMaterial FlipperElasticCoef, 1, RF3StaticFriction, RF3KineticFriction
If BallSpeed < 2 Then Exit Sub
End If
'Anti ball passtrhough over Flipper Drop Catch + Shake Effect. ( Avoid FP Engine Issue )
If RF3ContactPoint > 0 and RightFlipper3Ext.IsSolenoidOn = False and RF3AngleDiff < 5 and RightFlipper3Ext.Hit = True and RF3BallVSpeed > 200 then
RightFlipper3.SolenoidOn
RightFlipper3.SolenoidOff
End If
'Code for "Anti Backside shoot". This is to prevent ball kicking by the backside of flipper like a shoot, mainly to prevent ball drain from upper flipper with huge velocity
If RF3ContactPoint = 0 and RightFlipper3Ext.IsSolenoidOn = False and RF3AngleDiff < SwingAngleRF3 - 1 and BallSpeed > 20 then
RightFlipper3.SolenoidOn
RightFlipper3.SolenoidOff
End If
'Code for Power Ramp Up and EOS
RF3RampUpOmega = ( ( ( ( 100^RampUpLinearity / CoilRampUp^RampUpLinearity ) * RF3AngleDiff^RampUpLinearity ) / 100^RampUpLinearity ) * RF3Omega ) + ( ( ( RF3Omega / 100 ) * CoilRampStartPower ) - ( ( ( RF3Omega / 100 ) * CoilRampStartPower ) * ( RF3AngleDiff^RampUpLinearity / CoilRampUp^RampUpLinearity ) ) )
RF3Omega = ( BaseOmega - (RF3ContactPoint * ((BaseOmega - TipOmega)/1.2)))
If RF3ContactPoint > 0 and RF3AngleDiff <= CoilRampUp and RightFlipper3Ext.Hit = True then RightFlipper3Ext.Omega = RF3RampUpOmega Else RightFlipper3Ext.Omega = RF3Omega : End If
If RF3ContactPoint > 0 and RF3AngleDiff < SwingAngleRF3 - EOSAngle and RF3AngleDiff > CoilRampUp then RightFlipper3Ext.Omega = RF3Omega : End If
If RF3ContactPoint > 0 and RF3AngleDiff => SwingAngleRF3 - EOSAngle then RightFlipper3Ext.Omega = RF3Omega * EOSTorque : End If
'Code to apply Velocity correction when flipper "On"
RF3MoveFriction = RF3KineticFriction - (( RF3ContactPoint * RF3KineticFriction ) * RollingEffectRF3 )
If RightFlipper3Ext.IsSolenoidOn = True and RF3AngleDiff < SwingAngleRF3 - 0.05 and RF3ContactPoint > 0 then' and RF3ContactPoint < 1.2 then
RightFlipper3Ext.SetMaterial 0, 1, RF3StaticFriction, RF3MoveFriction
xBAM.ball.SetOmega -0.1,0.1,0.1
End If
'Ball Spinning stop on hit
If OverspinDeleter = 1 and RightFlipper3Ext.Hit and RF3ContactPoint < 1 and RightFlipper3Ext.IsSolenoidOn = True and RF3BallVSpeed > 50 then
xBAM.ball.SetOmega -0.1,0.1,0.1
RightFlipper3Ext.SetMaterial FlipperElasticCoef, 1, RF3StaticFriction, RF3MoveFriction
End If
End Sub
' ============================================ END OF PREHIT CODES ============================================
' ==============================================================================================================