Register    Login    Forum    FAQ    PinSimDB.org

Board index » Future Pinball » BAM corner




Post new topic Reply to topic  [ 26 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Magnetic fields in BAM
 Post Posted: Sun Feb 05, 2017 4:47 pm 
Offline

Joined: Mon Mar 25, 2013 4:02 pm
Posts: 950
Right now only in beta-BAM:
http://www.ravarcade.pl/beta/BAM.dll

Demo:
http://www.ravarcade.pl/beta/magneticfield_demo.fpt
This is test table with ball on chain.
Keyboard:
U - Move Up/Down ball-with-chain.
M - Enable/disable "Magnet". Light on playfield is used to visualize magnet position and it will be turned on when magnet is enabled.

New function:
Code:
Dim MF
MF = xBAM.CreateMagneticField( X, Y, Z, Range, Strength )

It will create object (magnetic-field).
That object has same properties as arguments names. You can read or set that properties anytime in script.
So you can for example move magnet:
MF.X = MF.X + 10
or change strength:
MF.Strength = MF.Strength - 10

You can create magnetic field or modify params in BAM, see [Magnetic Fields] menu (near Mini-Playfields).
CTRL-C will copy code ready to paste in script editor.

Magnetic field as "Magnet"
- will pull/push ball inside Range
- will pull/push harder if ball is closer to Magnet position
- if Strength is > 0 it will pull ball
- if Strength is < 0 it will push ball away

Code from demo table:
Code:
Dim MagneticField_light   '                                   X           Y    Z  Range Strength
Set MagneticField_light   = xBAM.CreateMagneticField(MF_light.X, MF_light.Y,   0,   200,       0)

In code above:
- I use MF_light.X, MF_light_Y instead of numbers. So when you move MF_light on playfield you will also move "magnet" position. MF_light is just "light" object in FP editor.
- I set Strength = 0. Magnet is turned off.
- All i need to turn is on is: MagneticField_Light.Strength = 5
Here is code from FuturePinball_KeyPressed subroutine:
Code:
If (KeyCode = 50) Then
   If MagneticField_Light.Strength = 0.0 Then
      MF_light.Set BulbOn, "11"
      MagneticField_Light.Strength = 5
   Else
      MF_light.Set BulbOff, "11"
      MagneticField_Light.Strength = 0
   End If
End If

In code above MF_light is also turne on/off.

Ball-on-chain - magnetic-field used to create fake Pendulum
This part uses mini-playfield to make visuals. Part of illusion is "invisible" ball. This invisible ball is only one, that can be hit. This "invisible" ball should behave like ball at end of pendulum.
Here is code make magnet used as pendulum:
Code:
Dim MagneticField_P        '                                X        Y        Z        Range    Strength
Set MagneticField_P        = xBAM.CreateMagneticField(    180,     470,     -10,      60,       1)
MagneticField_P.SingleBall = xBam.BallCloseTo(180.25, 470.75)

This code is execute right after creation of invisible ball (close to point 180.25, 470.75).
It almost same as normal magnet with one exception:
MagneticField_P.SingleBall = xBam.BallCloseTo(180.25, 470.75)
This line will "assign ball" closest to give point.
Here is list of diffrences, between magnet and "fake "penulum":
- "pendulum" will only affect one ball (that one "assigned")
- that assigned ball will be pulled to center harder if it is further
- Range - work little different. It may be used to control frequency of pendulum.

In demo table i use this "fake-pendulum-magnet" to lift ball above playfield surface.
Here is code from FuturePinball_KeyPressed subroutine:
Code:
If (KeyCode = 22) Then
   If MagneticField_P.Z <> 90 Then
      ' Move up
      MagneticField_P.Z = 90
      MagneticField_P.Strength = 15
   Else
      ' Move down
      MagneticField_P.Z = 0
      MagneticField_P.Strength = 1
   End If
End If

To lift ball up i move magnet above playfield (MegneticField_P.Z = 90) and increase it stregth (MagneticField_P.Strength = 15)

There is one more important thing:
Do not let the ball reach the center of the center of the magnet. If you forget about it, ball may accelerate in unpredictable direction. It can move slow to center of magnet and suddenly accelerate in weird direction. (See Voyager 1 & 2 slingshot path).

Update. (Feb 12, 2017)
Added Horizontal property of magnetic-field object.
If you set Horizontal = true, then force applied to ball will be always parallel to playfield surface. You will not be able to pull up ball or push it under playfield.

Update. (Feb 19, 2017)
Added MaxForce property of magnetic-field object.
You can set maximum force on Z axis.

_________________
http://www.ravarcade.pl
Better Arcade Mode
current BAM version: v1.4-254, released: May 25, 2019


Last edited by ravarcade on Sun Feb 19, 2017 3:56 pm, edited 2 times in total.

Top 
 Profile  
 
 Post subject: Re: Magnetic fields in BAM
 Post Posted: Sun Feb 05, 2017 5:58 pm 
Offline

Joined: Fri Nov 22, 2013 8:25 am
Posts: 166
Nice :D


Top 
 Profile  
 
 Post subject: Re: Magnetic fields in BAM
 Post Posted: Mon Feb 06, 2017 12:05 pm 
Offline
User avatar

Joined: Sun May 08, 2011 4:57 pm
Posts: 1071
Location: Turin-ITALY
When I read the title of the tread, I thought it was the magnet that appears on several tables..... Instead I see that you have well solved the problem of the chained ball (table Junkyard).
But I think your project could solve our problem to handle the magnet. Am I wrong?
Greetings and thanks for your great work with BAM.

Gianfranco


Top 
 Profile  
 
 Post subject: Re: Magnetic fields in BAM
 Post Posted: Mon Feb 06, 2017 12:52 pm 
Offline

Joined: Mon Jan 27, 2014 12:36 pm
Posts: 2612
Location: Ontario, Canada
franzleo wrote:
When I read the title of the tread, I thought it was the magnet that appears on several tables..... Instead I see that you have well solved the problem of the chained ball (table Junkyard).
But I think your project could solve our problem to handle the magnet. Am I wrong?
Greetings and thanks for your great work with BAM.

Gianfranco

Yes try the demo table posted above!!! :D


You are quite right it solves both ball and chain (press "U" key and it will raise and lower ball and chain)
Code:
' KeyCode = U (Up/Down)
   If (KeyCode = 22) Then
      If MagneticField_P.Z <> 90 Then
         ' Move up
         MagneticField_P.Z = 90
         MagneticField_P.Strength = 15
      Else
         ' Move down
         MagneticField_P.Z = 0
         MagneticField_P.Strength = 1
      End If
   End If


And Magnet. If you launch a ball and press "M" when it is close the magnet will grab the ball
Code:
' KeyCode = M (Magnet)
   If (KeyCode = 50) Then
      If MagneticField_Light.Strength = 0.0 Then
         MF_light.Set BulbOn, "11"
         MagneticField_Light.Strength = 5
      Else
         MF_light.Set BulbOff, "11"
         MagneticField_Light.Strength = 0
      End If
   End If



so this can be used for both magnets in Cirqus Voltaire and for the Ringmaster "ball and chain" and to raise the hidden ball with the magnet....

:shock:


Top 
 Profile  
 
 Post subject: Re: Magnetic fields in BAM
 Post Posted: Mon Feb 06, 2017 6:28 pm 
Offline

Joined: Mon Mar 25, 2013 4:02 pm
Posts: 950
I give you another idea what you can do with magnetic-fields:

You can use magnet like a kicker.
For example
if ball is at coords: x=483, y=940, y=13.5 (it is ball radius)
and magnet coords is: x=483, y=960, z=13.5,
magnet range = 45.0 (only this ball will be in range).
You can for example set magnet Strength = -100.0 (big negative value).
This should push ball up like kicker do.... but you can control Strength in script.

I know, that you can't control Kicker strength from script.
If you need, i can create example.

_________________
http://www.ravarcade.pl
Better Arcade Mode
current BAM version: v1.4-254, released: May 25, 2019


Top 
 Profile  
 
 Post subject: Re: Magnetic fields in BAM
 Post Posted: Tue Feb 07, 2017 10:33 pm 
Offline
User avatar

Joined: Sun May 08, 2011 4:57 pm
Posts: 1071
Location: Turin-ITALY
ravarcade wrote:
......If you need, i can create example........


I'm confused. Perhaps an example would be helpful. When a ball is attracted by the magnet, it has to be vibrated. So we will have a timer to turn off the magnet.
Thanks in advance

Gianfranco


Top 
 Profile  
 
 Post subject: Re: Magnetic fields in BAM
 Post Posted: Tue Feb 07, 2017 11:04 pm 
Offline

Joined: Mon Jan 27, 2014 12:36 pm
Posts: 2612
Location: Ontario, Canada


https://youtu.be/FILiKscSEX0

Like this Gianfranco ?


Top 
 Profile  
 
 Post subject: Re: Magnetic fields in BAM
 Post Posted: Wed Feb 08, 2017 4:16 am 
Offline

Joined: Fri Nov 22, 2013 8:25 am
Posts: 166
Quote:
I give you another idea what you can do with magnetic-fields:

You can use magnet like a kicker.
For example
if ball is at coords: x=483, y=940, y=13.5 (it is ball radius)
and magnet coords is: x=483, y=960, z=13.5,
magnet range = 45.0 (only this ball will be in range).
You can for example set magnet Strength = -100.0 (big negative value).
This should push ball up like kicker do.... but you can control Strength in script.

I know, that you can't control Kicker strength from script.
If you need, i can create example.


I read this and started thinking that "Champion Pub" would be possible.
https://youtu.be/7rEqA6BkYiA?t=58


Top 
 Profile  
 
 Post subject: Re: Magnetic fields in BAM
 Post Posted: Wed Feb 08, 2017 11:02 am 
Offline
User avatar

Joined: Sun May 08, 2011 4:57 pm
Posts: 1071
Location: Turin-ITALY
Gimli wrote:
.........Like this Gianfranco ?..........


Capers :shock: !! It is a terrific thing :shock: . Well, I think I use it in the table I'm working with Wild (Paolo): Dragon's Keep.
I'll let you know the evolution of the table.
Greetings ......... and a big thanks to Rafal.

Gianfranco


Top 
 Profile  
 
 Post subject: Re: Magnetic fields in BAM
 Post Posted: Wed Feb 08, 2017 1:04 pm 
Offline
User avatar

Joined: Sun May 08, 2011 4:57 pm
Posts: 1071
Location: Turin-ITALY
It all works wonderfully, but there is a small problem.
If the ball stays a long time in the magnet, it is implanted in the PF.
To have a little more strength in the magnet , I set :

MagneticField_Light.Strength = 30-50

Look at the photo
Greetings

Gianfranco


You do not have the required permissions to view the files attached to this post.


Top 
 Profile  
 
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 26 posts ]  Go to page 1, 2, 3  Next

Board index » Future Pinball » BAM corner


Who is online

Users browsing this forum: No registered users and 2 guests

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to: