*** UPDATED 11/1/2020***

In this tutorial, I’ll cover adding physics for drop targets that creates more realistic behavior.  It allows the ball to ‘move’ through the target enabling the ability to score more than one target with a well placed shot.  I’ve made some significant changes since I first posted this tutorial that hopefully will make implementing a little easier.  It also handles full drop target animation, including deflection on hit and a slight lift when the drop targets raise, switch handling, bricking, and popping the ball up if it’s over the drop target when it raises.

For each drop target, we’ll use two wall objects for physics calculations and one primitive for visuals and animation.  We will not use target objects.  Place your drop target primitive the same as you would a VP drop target.  The primitive should have it’s pivot point centered on the x and y axis and at or just below the playfield level on the z axis.  Orientation needs to be set using Rotz and bending deflection using Rotx.  You’ll find a hooded target mesh in the sample table below.  It uses the same texture map as the VP drop targets (thanks to @bord).

Next we’ll add two wall objects.  The first will be placed in the same location as the drop target.  The second will be offset behind the first (as though the target is deflected).

Next we’ll start configuring the script.

First will add the CorTracker.  This code tracks the velocities of all the balls on the table.  It is also used by the rubber dampeners.  It has been updated and you’ll need to use the attached code for the drop targets to work properly and it is backwards compatible with the rubber dampener code.  Note: you will also need to add a timer named RDampen, enabled, with an interval of 1.

CorTracker Functions

Then we’ll initialize all of our drop targets and set constants that control the behavior of the drop targets.

For each drop target, we’ll create a variable and set an array of values containing the following:

  • Name of the primary wall
  • Name of the secondary wall (offset wall)
  • Name of the drop target primitive
  • The switch number
  • The animation state (always initialized to zero)

For example:

Dim DT25
DT25 = Array(sw25, sw25offset, primsw25, 25, 0)

Once we’ve declared all of our drop targets, we’ll add their variables to an array named DTArray

Dim DTArray
DTArray = Array(DT25, DT26, DT27 ….)

We’ll also need to set behavioral and sound constants including the following.  These should mostly work without modification if using the sample drop target mesh, but you can tweak to your own taste.

‘Configure the behavior of Drop Targets.
Const DTDropSpeed = 110 ‘in milliseconds
Const DTDropUpSpeed = 40 ‘in milliseconds
Const DTDropUnits = 44 ‘VP units primitive drops so top of at or below the playfield
Const DTDropUpUnits = 10 ‘VP units primitive raises above the up position on drops up
Const DTMaxBend = 8 ‘max degrees primitive rotates when hit
Const DTDropDelay = 20 ‘time in milliseconds before target drops (due to friction/impact of the ball)
Const DTRaiseDelay = 40 ‘time in milliseconds before target drops back to normal up position after the solenoid fires to raise the target
Const DTBrickVel = 30 ‘velocity at which the target will brick, set to ‘0’ to disable brick

Const DTEnableBrick = 1 ‘Set to 0 to disable bricking, 1 to enable bricking
Const DTHitSound = “targethit” ‘Drop Target Hit sound
Const DTDropSound = “DTDrop” ‘Drop Target Drop sound
Const DTResetSound = “DTReset” ‘Drop Target reset sound

Const DTMass = 0.2 ‘Mass of the Drop Target (between 0 and 1), higher values provide more resistance

Drop Target Initialization Sample

Next we’ll add in the Drop Target Functions, which will also require a timer be added in the editor named DTAnim.  The script will enable it and set the interval.  This code should not need to be modified unless you are implementing on an EM or original table.

Drop Target Functions

With this code, there’s no need to use the VP initialization for the drop targets.  Instead, you’ll just add hit subs for each drop target like so (notice how the targets are referred to using only the switch number):

Sub Sw25_Hit : DTHit 25 : End Sub

For the drop bank reset tied to the solenoid you’ll add something like this:

Sub ResetDrops(enabled)
     if enabled then
          PlaySoundAt SoundFX(DTResetSound,DOFContactors), cutout_prim1
          DTRaise 25
          DTRaise 26
          DTRaise 27
          DTRaise 28
     end if
End Sub

Or a solenoid driven drop can be performed like so:

Sub Drop1(enabled)
     If enabled Then
          DTDrop 28
     End If
End Sub

I’ve included Centaur here as a sample table with this code implemented.

Centaur (Bally 1981) DT

 

22 Comments
  1. bord 1 month ago

    Like manna from heaven.

    Thank you.

  2. randr 1 month ago

    Amazing stuff Bill! Very much appreciated.

  3. Thalamus 1 month ago

    I’m sure that this is going to become yet another leap for VP in the right direction and I’m happy to see you posting this after a small hiatus. Downloading Big Shot now, planning to play it tomorrow with beers. ;-)

  4. bord 1 month ago

    I have tested this in a couple games and it is bananas. Seeing more than one target drop when you hit directly between two targets is a revelation. Please tell me you’re privately sharing this with the devs. Impossible to see how the rubber dampening script and now this shouldn’t be built into VP. Once you play one game with it you don’t want to play another game without it.

  5. bord 1 month ago

    In an alternate universe VPX 10.7 beta lasted two weeks and consisted of 10.6 plus the following being written into the program:

    -roth’s rubber dampening script
    -roth’s saucer/kicker script
    -roth’s drop target script
    -roth’s flipper trajectory script

    :mail:

  6. Author
    rothbauerw 1 month ago

    Fuzzel did ask for help to build in the drop target stuff. I just haven’t been able to get to it. Now that I’ve written this part, hopefully I can bring it back to fuzzel and get it built into 10.7.

    That said, I do think this will need a little refinement though. Just watching some videos of Flash Gordon and the targets behave a little differently there. I think this can still be a good and better approximation, but some enhancements may also be in order. Would love others thoughts.

  7. BorgDog 1 month ago

    Have you built in the classic Bally drop target reject? 😁

  8. Author
    rothbauerw 1 month ago

    No, but I’d love some video of it if you have it. I think that’s related to the differing behavior I’m seeing on the Flash Gordon videos. I assume you’re referring to a hard strike where the target doesn’t drop?

  9. BorgDog 1 month ago

    Took me a few games, but got a nice 4 drop sweep on Big Shot. Excellent work. :good: :rose: :heart: :yes:

    would love to see this and all your other stuff built into vp7 as @bord says.

  10. BorgDog 1 month ago

    Yup, the hard strike no drop issue. classic Sterns have that issue a lot too, especially with replacement targets (I think they are less stiff or something). If I can track down some video of it I’ll link it.

  11. bord 1 month ago

    The thinner, non-hooded classic Stern drops fall if you talk too loud. They were phased out halfway through Meteor production and there aren’t any replacements for sale, so you see lots of the harder to drop ones Borg is referring to.

  12. cyberpez 1 month ago

    Does this work for stand up targets also? hmmmmm

    I mean they should work the same (hitting multiple….) they just don’t drop

    • Author
      rothbauerw 1 month ago

      Currently, no, it won’t work the same for standup’s because they don’t drop out of the way for the ball to pass through. But maybe with some enhancements it could.

      I think we need to create something that allows the ball to partially pass through the target (i.e., the target bends backwards after it’s hit before propelling the ball forward). It would make things a little more complex, but I’m thinking maybe we need another target placed behind the original so it can pass through the first and be repelled by the second. This could theoretically allow double hits on stand ups and might also better simulate the drop target behavior I’m seeing on Flash Gordon. It should then also be possible to add in a drop target reject.

  13. cyberpez 1 month ago

    the first could be a drop, to trigger the bending and getting out of the way? then a stand up to actually trigger the hit

  14. Author
    rothbauerw 1 month ago

    Just a quick note for anyone trying to implement this. I think you need to make the targets uncollidable when they drop and collidable again when they raise for this to work or the ball will bounce off the target despite this code. I’ll add to the tutorial above when I have time.

  15. Author
    rothbauerw 1 month ago

    Another note of caution. The second target will drop when hit. This can be prevented by setting a very high Hit Threshold on the second target (1000?) or by using a wall instead.

  16. nestorgian 1 week ago

    I will try to implement it in the Mr Evil / Mr Doom in development
    is there any electromagnetics with this method at present
    Thanks

  17. nestorgian 1 week ago

    I would ask if there was already an EM vpx table that implements this method of placing drop targets
    By modifying the Drop Target Functions script I understand that it would be ready to be used in an EM table

    • Author
      rothbauerw 1 week ago

      It can be used on EM’s but will require some minor script modifications. I have not used this specific method on an EM so I don’t have an example script at this time.

  18. Author
    rothbauerw 1 week ago

    @nestorgian

    For an EM, you can comment out the following line:

    ‘controller.Switch(Switch) = 0

    Then replace the following line with a call to an EM drop target scoring sub:

    replace:

    ‘controller.Switch(Switch) = 1

    with:

    EMDTScore(switch)

    Then add the score sub with the logic you desire like so:

    Sub EMDTScore(switch)
    Select Case switch
    Case 0: 'DT scoring logic for DT 0 here
    Case 1: 'DT scoring logic for DT 1 here
    Case 2: 'DT scoring logic for DT 2 here
    End Select
    End Sub

  19. nestorgian 1 week ago

    thanks for your time and your teachings :mail: :good:

Leave a reply

©2020 VPinBall.com

Log in with your credentials

or    

Forgot your details?

Create Account

The Vpinball app

FREE
VIEW