Any custom FP object type that supports sending multiple Hit events for multiple balls?

madmrmax

Weeeeeee
Site Supporters
Joined
Sep 21, 2017
Messages
462
Solutions
1
Reaction score
237
Points
55
Favorite Pinball Machine
Indiana Jones (Williams)
I'm trying to create something which can act like a Trigger that tells me when one or more balls are in the trigger area and leave the trigger area. I'm only wanting to position the "mirror balls" when the balls on main playfield are within the mirror region. Currently I'm using NewtonPhysicsTick to position the mirror balls.

Options:

1. I currently have this done with a custom model of Trigger type (blue below). This is good for one ball, but FP doesn't seem to support sending a Hit event when a second ball enters the area if the first ball is already there. The limitation makes sense, but I'm just curious if there is something I'm missing.
1738952965672.png
2. I was considering a second approach by creating a Toy FP object which has 4 hit areas, and then use fpEventID in the Hit event to see what side was "hit" and check if the ball hit is different than the ball I'm tracking, and if so, start tracking the additional ball in the area (up to 4). The problem is that the FPM Editor doesn't seem to show multiple collision shapes when using a Toy object type. So, I assume that generic/custom Toy objects actually do not support doing this.
1738953628788.png1738953747541.png

3. Of courser Occam’s razor: Since I know there is a max of 4 balls in Theatre of Magic, just write code which tracks a) the number of balls in play, and b) the location of each ball in play. And then loop through the active balls to see if the position of the ball is within the "trigger area" and I perform the mirror position logic. The problem here is that while rectangle math is easy, I was hoping to get a little more creative in my trigger model where it isn't a regular rectangle. Then the math becomes challenging if I want to calculate if the ball is within the orange area below:
1738954192774.png

Any thoughts? Any workarounds to the issues found in #1 or #2 above? I wish there was a BAM function which I could say "Is this x, y, z coordinate contained within a 3D model"
 
Just adapt your #1 solution: create 4 invisible uncollidable optos in order to born your area (really, 3 are enough) and after test the coordinates (balls enter or left the area).
#2: toy don't have collision(s) shape(s), so...
#3: so you have to test every x ms where the balls are. A little bit CPU consuming.
 
What if the hit is only applied on the borders (like an invisible wall), and you define a way to distinguish the ball entering or exiting the zone based on coordinates?

Something like this pseudo-code

Code:
Dim MirrorBalls()
Sub Trigger wall is hit
    Check current ball coordinates or whatever
    If the ball is entering the zone
        Redim MirrorBalls to add the current ball ID
    Else
        Redim MirrorBalls to remove the current ball ID
    End If
End Sub

Sub NewtonPhysicsTick()
    If MirrorBalls Length is > 0
        For each ball in MirrorBalls
            Apply function on that specific ball
        Next
    End If
End Sub

This is just an idea but it's all I can think of for this, multi ball managing is often rough for these things.
 
Just adapt your #1 solution: create 4 invisible uncollidable optos in order to born your area (really, 3 are enough) and after test the coordinates (balls enter or left the area).
#2: toy don't have collision(s) shape(s), so...
#3: so you have to test every x ms where the balls are. A little bit CPU consuming.
do Optos go through FP objects (walls, etc) and models that are collidable?
 
do Optos go through FP objects (walls, etc) and models that are collidable?
I really don't know (must be tested, but, for me, why not), but, with your case, 2 vertical optos at the top and 1 horizontal opto below the trigger wires must be good.
 
Anyone know the math to figure out if the ball direction is going "inwards" vs "outwards" (relative to the "orange area I'm interested in) when crossing an opto path?
 
Just test the velocity.
 
Just going to say that @Popotte - using opto triggers is working really well, and no issues with objects being in the way. And I'm using a combo of Hit and Unhit events on the trigger along with velocity to determine if the ball is going in or out of the area. Thanks for your help!

1739173104900.png
 
General chit-chat
Help Users
You can interact with the ChatGPT Bot in any Chat Room and there is a dedicated room. The command is /ai followed by a space and then your ? or inquiry.
ie: /ai What is a EM Pinball Machine?
  • No one is chatting at the moment.
  • Chat Bot Mibs Chat Bot Mibs:
    MedievilMadness has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Pinbalbilly has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    flipjuice has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    apollo2000 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Gmelo1 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    jose49 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    darcel has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    cocopops has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Nightvoice has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    drew1 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Cicero Silva has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    manstein has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    1000 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Destruck62 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    WeadlyDeapon has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    SaixXemnas has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Gege has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Fatmeatball has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    titomajo has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    daveseawater has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    rockin ray has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Citron68 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    hammerpower has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    max37170 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    OZZOLO has left the room.
      Chat Bot Mibs Chat Bot Mibs: OZZOLO has left the room.
      Back
      Top