***** UPDATED TO INCLUDE PHYSICS FOR FLIPPER TRICKS *****
VPX physics have come a long way in the past two years. Authors have been optimizing settings and have produced amazing results using different methods. I personally have been very happy with a wide variety of physics by different authors and often study what different authors are doing. As a result of those studies, I’ve found nFozzy’s physics to be the closest to real pinball. He’s done some pretty amazing work that extends the physics capabilities of vpx! This tutorial is an introduction on how to add nFozzy’s physics to a table.
nFozzy’s Terminator 2 and Space Station are great example tables of what his physics can do and how he’s implemented some of the methods I will walk through. I encourage you to dig into these tables if you’re interested in what he’s doing.
A couple of years ago I released a flipper trajectory testing table. It allowed the user to adjust flipper settings and visualize the ball trajectories and velocities when flipping at various locations along the length of the flipper. What I found was that a number of shots didn’t have appropriate trajectories or velocities compared to real flippers. For example, backhands were too vertical and the velocities were too low. In addition, trajectories tended to group at various locations along the length of the flipper. The middle third of the flipper often had tightly grouped trajectories that made certain shots either super easy or super difficult.
nFozzy took what I did to an entirely different level. He built in the ability to test VPX flippers and compare them directly to real flipper performance. He then developed scripting that allowed him to “adjust” the profile of the flipper trajectories and velocities to more closely match those of a real flipper. Playing either Terminator 2 or Space Station and you’ll quickly feel the difference and more even distribution of shots along the length of the flippers.
Implementing nFozzy’s Solution
There are several steps for taking advantage of nFozzy’s flipper solution. At a high level we’ll need the following:
- flippers with specific physics settings
- custom triggers for each flipper
- an object or point to tell the script where the tip of the flipper is at rest
- and, special scripting
The following settings are a solid starting point for various eras of pinballs.
Flipper Physics (assumes a ball mass of 1 and diameter of 50)
|late 70’s to mid 80’s||mid 80’s to late 80’s||
early 90’s and later
|Coil Ramp Up||2.5||2.5||2.5|
|EOS Torque Angle||6||6||6|
* requires special scripting to prevent a “springy” flipper when the flipper is held in the up position (covered below)
Flipper Triggers and Flipper End Points
We’ll add two triggers to the table using the trigger shape “TriggerNone”. One for the left flipper (TriggerLF) and one for the right flipper (TriggerRF). The image below shows the approximate shape of the triggers. Essentially, they should surround the shape of the flippers from start angle to end angle. I recommend the trigger be 23 vp units larger than the flipper objects (no larger and no smaller). I’ve used a 23 x 23 wall in the image below to help me properly size the triggers.
For the end points, use a standard primitive with 30 sides and an XSize and YSize of 2 times the end radius of the flippers. Place them a closely as possible to end of the flippers and name them “EndPointLp” for the left flipper and “EndPointRp” for the right flipper. Make sure they are not visible and are not collidable.
First, download and include the necessary supporting functions in your table script.
Second, create two new objects using the FlipperPolarity Class.
dim LF : Set LF = New FlipperPolarity ‘Left Flipper
dim RF : Set RF = New FlipperPolarity ‘Right Flipper
Third, configure the profile to adjust trajectory (polarity) and velocity. Note that the name of the left flipper and right flipper are assigned to the corresponding objects and the end point primitives we created in a previous step are assigned. The example below corresponds to the flipper profile for Terminator 2 (90’s and beyond pinballs).
dim x, a : a = Array(LF, RF)
for each x in a
‘safety coefficient (diminishes polarity correction only)
x.AddPoint “Ycoef”, 0, RightFlipper.Y-65, 1
x.AddPoint “Ycoef”, 1, RightFlipper.Y-11, 1
x.enabled = True
x.TimeDelay = 44
addpt “Velocity”, 0, 0, 1
addpt “Velocity”, 1, 0.2, 1.07
addpt “Velocity”, 2, 0.41, 1.05
addpt “Velocity”, 3, 0.44, 1
addpt “Velocity”, 4, 0.65, 1.0’0.982
addpt “Velocity”, 5, 0.702, 0.968
addpt “Velocity”, 6, 0.95, 0.968
addpt “Velocity”, 7, 1.03, 0.945
AddPt “Polarity”, 0, 0, -4.7
AddPt “Polarity”, 1, 0.16, -4.7
AddPt “Polarity”, 2, 0.33, -4.7
AddPt “Polarity”, 3, 0.37, -4.7
AddPt “Polarity”, 4, 0.41, -4.7
AddPt “Polarity”, 5, 0.45, -4.7
AddPt “Polarity”, 6, 0.576,-4.7
AddPt “Polarity”, 7, 0.66, -2.8
AddPt “Polarity”, 8, 0.743, -1.5
AddPt “Polarity”, 9, 0.81, -1.5
AddPt “Polarity”, 10, 0.88, 0
LF.Object = LeftFlipper
LF.EndPoint = EndPointLp ‘you can use just a coordinate, or an object with a .x property.
RF.Object = RightFlipper
RF.EndPoint = EndPointRp
Forth, add hit and unhit subs for the flipper triggers.
‘Trigger Hit – .AddBall activeball
‘Trigger UnHit – .PolarityCorrect activeball
Sub TriggerLF_Hit() : LF.Addball activeball : End Sub
Sub TriggerLF_UnHit() : LF.PolarityCorrect activeball : End Sub
Sub TriggerRF_Hit() : RF.Addball activeball : End Sub
Sub TriggerRF_UnHit() : RF.PolarityCorrect activeball : End Sub
Fifth, we need to replace the flipper.rotatetoend statements with the following (typically in the SolLFlipper and SolRFlipper subs):
The script for steps 2-4 are included here for three eras of pinballs. I recommend not changing the profiles unless you really know what you’re doing.
If you have completed the above steps correctly, your flippers should now have polarity and velocity correction enabled.
Next, we need to add code to enable flipper tricks physics. This code addresses deficiencies in the VP flipper physics to prevent a “springy flipper” when the flipper is held in the up position, enhances the coil ramp up up curves allowing for drop catches and tap passes, simulates the absorption of ball momentum (allowing for live catches), and corrects some buggy behavior in the flipper code that at times causes weird bouncing behavior.
First, we’ll add the following to the key down sub:
If keycode = LeftFlipperKey Then LFPress = 1 If keycode = RightFlipperKey Then rfpress = 1
Second, we’ll add the following to the key up sub:
If keycode = LeftFlipperKey Then lfpress = 0 leftflipper.eostorqueangle = EOSA leftflipper.eostorque = EOST End If If keycode = RightFlipperKey Then rfpress = 0 rightflipper.eostorqueangle = EOSA rightflipper.eostorque = EOST End If
Third, we’ll add the remainder of the attached scripting. Note this uses the right flipper timer in case you’re using for some other purpose.
Please note that geometry can be very important when designing a table for flipper tricks. For example, the position of lane guides in relation to the flipper can have significant impacts on the ability to post pass. If the lane guides are too high, the ball may deflect of the guide preventing if from achieving the necessary trajectory.
Attached is an example table that uses the steps above to implement these flipper physics for a late 80’s to mid 90’s table.