freezy / VisualPinball.Engine

:video_game: Visual Pinball Engine for Unity
https://docs.visualpinball.org
GNU General Public License v3.0
396 stars 62 forks source link

Add Flipper Rubber Dampening when Flipper is in Up-Position #438

Open Cupiii opened 2 years ago

Cupiii commented 2 years ago

Flippers on newest VPW-Releases have some dampening (only if Flipper is held up and no live catch happened) and when abs(velx) < 2 and vely < 0 and vely > -3.75

This should be implemented.

'######################### Add new FlippersD Profile
'#########################    Adjust these values to increase or lessen the elasticity

dim FlippersD : Set FlippersD = new Dampener
FlippersD.name = "Flippers"
FlippersD.debugOn = False
FlippersD.Print = False 
FlippersD.addpoint 0, 0, 1.1    
FlippersD.addpoint 1, 3.77, 0.99
FlippersD.addpoint 2, 6, 0.99

'######################### Add Dampenf to Dampener Class 
'#########################    Only applies dampener when abs(velx) < 2 and vely < 0 and vely > -3.75  

    public sub Dampenf(aBall, parm)
        dim RealCOR, DesiredCOR, str, coef
        DesiredCor = LinearEnvelope(cor.ballvel(aBall.id), ModIn, ModOut )
        RealCOR = BallSpeed(aBall) / cor.ballvel(aBall.id)
        coef = desiredcor / realcor 
        If abs(aball.velx) < 2 and aball.vely < 0 and aball.vely > -3.75 then 
            aBall.velx = aBall.velx * coef : aBall.vely = aBall.vely * coef
        End If
    End Sub