BAM BAM Set Velocity Demystified ?

Gimli

Pinball Master
Joined
Feb 6, 2020
Messages
1,341
Reaction score
882
Points
120
Favorite Pinball Machine
Monster Bash
@wild
@ravarcade
@TerryRed
@shiva
@AnonTet
@NitroNimbus
@Gin
@ikesavage

I have limited time to post at this time but I have to confess I have been enamored by the holy grail of the magic code for BAm/Fp and in fact a unifying theory of the universe

and I thought this might be it this :trippy: :
Code:
ball.SetVelocity YourMagicValue*sin(BallTrajectory * DegToRad), -YourMagicValue*cos(BallTrajectory  * DegToRad), 0

And in some ways it is but what are the "Sin" and "Cos" values and are they truly needed or are we just being pretentious.....let me explain. So buckle up and get comfy and lets untangle this mystifying web a little. Please excuse my lame understanding of physics and math as I am squinting trying to remember grade 11 math and physics.:bonk:but somehow for me at least it bears telling....
 
Last edited:
Ok lets break it down and see where I went wrong and got sucked down that Carrollian Rabbit Hole.
 
Now it has been some time since Ravarcade has enabled real time physics monitoring through BAM.
And unbeknownst to the sleeping universe we can covertly track your pinball as it navigates its lived experience around the traumatic ebbs and flows of life in the playfield.

Big brother knows the balls x and y velocity , it knows the balls speed , it knows it location and through "prehit" it knows its destination.

In fact the movement of the pinball can be so predictable that it can be understood by Velocities , trajectories and grade 10 math trigonometry and understanding of right angle triangles...at least in my world view.
 
My recent foray into oblivion in this regard involved striking a billiard ball based on the angle of the pool cue at impact. This of course would be translated through the cue to the ball and in turn generate a trajectory for the cue ball to roll.

See diagram below demonstrating a ball trajectory of 30 degrees. ( Shoot to the top right corner of the playfield)
Trajectoy.gif
 
Last edited:
I've been a tech for 25 years... and as soon as I see math, I go blaaaaaaaaaaaaaah. :)

Glad you have the passion for this apsect. I just like blowing things up on pinball tables. :)
 
ok, you are substituting Speed Number for YourMagicValue, my question, what changes?
ball.SetVelocity SpeedNumber*sin(BallTrajectory * DegToRad), -SpeedNumber*cos(BallTrajectory * DegToRad), 0

ok, I understand that physics is a particular science, and somehow it is also in the world of pinball machines, and thanks to Rav, who is a programmer, we have bam, who uses this science for pinball machines ... in fp more than anything else .....but

For more than a century, physicists have hoped that they were closing in on the Holy Grail of modern science - a unifying theory that would make sense of the entire physical world, from the subnuclear realm of quarks and gluons, to the very moment of the creation of the universe. This book is a history of the attempts to find a "theory of everything", arguing that it will never be found, and warning that the compromises necessary to produce a final theory may well undermine the rules of doing good science. At the heart of the book is the rise of the particle physicists, and their attempts to reach far out into the cosmos for a unifying theory. Working beyond the grasp of the largest telescopes or the most powerful particle accelerators, and unable to subject their findings and theories to experimental scrutiny, they have moved into a world governed by mathematical and highly speculative theorizing, none of which can be empirically verified. David Lindsey argues that a theory of everything derived from particle physics will be full of untested - and untestable - assumptions. And if physicists yield to such speculation, the field will retreat from the high ground of science, becoming instead a modern mythology. This would surely be the end of physics as it is known today.

I read this introduction, it talks about physics as if it were the force that governs the universe, it is that it tries to give answers to things that only using human understanding is not enough and that cannot give....
I could give a sermon on this .... but it doesn't seem the case

instead I would like to understand what goes through your mind.....
 
Last edited:
Now in billiards we are imposing a velocity on a stationary cue ball.
the Red arrow vector above represents the velocity of the cue ball . Velocity is a directional value based on speed and trajectory.

If you break down the Red Velocity vector , you will see that it can be seen as a composite of the x + y Velocities ( and z velocity...but on a flat playfield this zero so lets ignore it for now....)

See image below...you can see how our red velocity vector is composed of the blue Velocity.y and the green Velocity.x.
It has a trajectory of 30 degrees.
You can also see how this generates a RIGHT ANGLE TRIANGLE !
Did I mention velocity can be broken down to a RIGHT ANGLE TRIANGLE ?


now admittedly I couldn't remember a lot of math...but I did remember that there was something special about right angle triangles.....

Do you remember the mnemonic "SOH CAH TOA " and the Pythagorean theorem ? Neither did I :trippy: :trippy:

Velocity.gif
 
Last edited:
And in some ways it is but what are the "Sin" and "Cos" values and are they truly needed or are we just being pretentious.....let me explain. So buckle up and get comfy and lets untangle this mystifying web a little. Please excuse my lame understanding of physics and math as I am squinting trying to remember grade 11 math and physics.:bonk:but somehow for me at least it bears telling....
what is "Sin" and "Cos"?

Ok lets break it down and see where I went wrong and got sucked down that Carrollian Rabbit Hole.

you talk weird, I can't understand, but maybe I shouldn't ...
 
what is "Sin" and "Cos"?
Let me explain I am getting to the point in my own crazy way
you talk weird, I can't understand, but maybe I shouldn't ...
Ya I am talking weird "Carrollian" refers to Lewis Carroll who wrote Alice in Wonderland who got sucked down a rabbit hole of imagination.
 
It's ok wild. I'm also Canadian, and I don't understand anything he is saying. :)
 
Lets get back to the math

1. What is "SOH CAH TOA"?

Some greek guy figgered out long ago that with right angle triangles

Sin (angle) = Opposite / Hypotenuse "SOH"
Cos(angle) = Adjacent / Hypotenuse "CAH"
Tangent(angle) = Opposite/Adjacent "TOA"

2. And Pythagorus...I presume some other greek guy ....maybe a cousin of the guy above discovered that when you look at the sides of a right angle triangle ( C squared = A Squared + B Squared)
 
Last edited:
Let me explain I am getting to the point in my own crazy way

Ahhhhhhhhh.....I can not wait......between madmen we should understand each other?
Ya I am talking weird "Carrollian" refers to Lewis Carroll who wrote Alice in Wonderland who got sucked down a rabbit hole of imagination.
how I would like to be that rabbit .....:bonk:
 
So what does this all have to do with pinball ?
Everything ! and of course nothing ! ( which is kinda beautiful...he he )

No seriously this is math I learned > 40 years ago and forgot and now it rears it's beautiful head...who knew ?

So if we can reduce the physics to right angle triangles (which we can...see image above) and if BAM can monitor all the values (which it can) ...then we can unlock cool stuff with Ravs new coding....

THIS IS THE ENTIRE POINT of this thread understand this at your own peril :bigdance:
 
Ok let's reload one of the images above.
You should see some dotted arrows at the bottom of the playfield ?
This is to illustrate the plus and minus vectors of x and y velocities.

A negative y velocity occurs when the ball rolls up the table away from the flippers
A positive y velocity occurs when the ball rolls down the table toward the flippers

A positive X velocity occurs when the ball rolls from left to right
A negative X velocity occurs wen the ball rolls from right to left
Velocity.gif
 
Last edited:
Lets get back to the math
it will seem strange to you, but I remember reading something like this, but I don't remember where ... if at school, or in the evening course which I did a long time ago

you could make a drawing of this?
Sin (angle) = Opposite / Hypotenuse "SOH"
Cos(angle) = Adjacent / Hypotenuse "CAH"
Tangent(angle) = Opposite times the Adjacent

2. And Pythagorus...I presume some other greek guy ....maybe a cousin of the guy above discovered that when you look at the sides of a right angle triangle ( C squared = A sqaured + B Squared)
in simple terms????
 
to be continued.....
 
Ok let's reload one of the images above.
You should see some dotted arrows at the bottom of the playfield ?
This is to illustrated the plus and minus vectors of x and y velocities.

An negative y velocity occurs when the ball rolls up the table away from the flippers
A positive y velocity occurs when the ball rolls down the table toward the flippers

A negative X velocity occurs when the ball rolls from left to right
A positive X velocity occurs wen the ball rolls from right to left
very clear this, but I have questions

the big black circle is the ball?
the blue arrow, is it the direction of your ball?
try to hit the small ball, at 30 degrees,following the reasoning of right angles?that before, you could not know how to perform....and now you have enlightenment ??? did I get it right????
 
very clear this, but I have questions

the big black circle is the ball?
the blue arrow, is it the direction of your ball?
Red Arrow is direction of ball
The ball is the tiny circle at the tip of the red arrow
The Big Black circle is for the 360 degrees of Ball Trajectory ( like a clock )
try to hit the small ball, at 30 degrees,following the reasoning of right angles?that before, you could not know how to perform....and now you have enlightenment ???
Exactly.....my error I will get to...but I will save you the pain.
For stationary objects like hitting a cue ball , you need this code.

For speeding up already moving balls you don't ....he he
this code will work as I showed you but to make it simple for moving balls all you need is

ball.SetVelocity ball.velocity.x, ball.velocity.y, 0

ball.velocity.x and ball.velocity.y BAM gives you ...you don't need fancy math at all
 
Last edited:
I'm already lost, but then I was skipping math class in school to go play the Playboy machine
 
Red Arrow is direction of ball
The ball is the tiny circle at the tip of the red arrow
The Big Black circle is for the 360 degrees of Ball Trajectory ( like a clock )
ahhh..ok,clearer now!
Exactly.....my error I will get to...but I will save you the pain.
For stationary objects like hitting a cue ball , you need this code.

For speeding up already moving balls you don't ....he he
this code will work as I showed you but to make it simple for moving balls all you need is
good!!
ball.velocity.x and ball.velocity.y BAM gives you ...you don't need fancy math at all
ehhhh.....you know how much I would like it,also for other things.

why? Speed Number for YourMagicValue
and why? the "boost" didn't work for me.......HERE

PS: I woke up to go to the bathroom(Pee), I had this nail in my head, my curiosity, for this concept, made me turn on the pc, to see..... but I back into my bed.
 
Ok let's reload one of the images above.
You should see some dotted arrows at the bottom of the playfield ?
This is to illustrate the plus and minus vectors of x and y velocities.

A negative y velocity occurs when the ball rolls up the table away from the flippers
A positive y velocity occurs when the ball rolls down the table toward the flippers

A negative X velocity occurs when the ball rolls from left to right
A positive X velocity occurs wen the ball rolls from right to left

View attachment 19065

So far so good.

But I wonder what's is wrong regarding the bold text: Is the "dotted plus" in the image backwards for X axis or is the text that is backwards? I think it is the text that is wrong but...

I have to admit I'm surprised. I never though about trigonometry in 30+ years and never Cos/Sin/Tan were explained so well to me before. I only remember the a2+b2=c2 because of a portuguese mnemonic... It's one of those things that are hard to forget.

I always wished math could be explained with games and rhymes instead of just dumping formulas. Didn't happen on my time.

Thanks Gimli.
 
So far so good.

But I wonder what's is wrong regarding the bold text: Is the "dotted plus" in the image backwards for X axis or is the text that is backwards? I think it is the text that is wrong but...

I have to admit I'm surprised. I never though about trigonometry in 30+ years and never Cos/Sin/Tan were explained so well to me before. I only remember the a2+b2=c2 because of a portuguese mnemonic... It's one of those things that are hard to forget.

I always wished math could be explained with games and rhymes instead of just dumping formulas. Didn't happen on my time.

Thanks Gimli.
Thanks ! I corrected the x velocity description ?
Ok I will try to get to the point soon.
Let's refresh where I was going with this image.
VelocitySOH.gif


So using the math we can say this:

sin (Trajectory) = Velocity.x /Velocity
or
Velocity.x =Velocity x sin(Trajectory)

1. I believe the "Velocity" or Red arrow is the same as ball.speed in BAM
2. In diagram Trajectory = 30 degrees
3. For the math we need to convert "Degrees" to "Radians"


FP Code:
Velocity.x = ball.speed * sin(Trajectory * DegToRad)
 
Last edited:
Ok now let's use the "CAH" math

cos (Trajectory) = Velocity.y / Velocity
or
Velocity.y = Velocity X cos (Trajectory)

FP Code:
Velocity.y = ball.speed * cos(Trajectory * DegToRad)
 
Last edited:
Remember the new FP code ?

ball.SetVelocity Velocity.x, Velocity.y, Velocity.z

For now lets assume a flat table like in billiards.
If that is the case Velocity.z is always zero ( no elevation component)
(I haven't yet checked out whether for full accuracy we should consider velocity.z for pinball tables to account for the elevation caused by the table slope and ramps...)

Velocity.x = ball.speed * sin(Trajectory * DegreeToRad)

Velocity.y = ball.speed * cos(Trajectory * DegreeToRad)




So it should be clear we can plug either side of the equation into the BAM code.

1. .For Billiards and shooting from a canon or whatever where you start with a stationary ball. You will use the right side of the equations above
ball.SetVelocity ball.speed * sin(Trajectory * DegreeToRad), -ball.speed * cos(Trajectory * DegreeToRad),0

*I found the velocity.y value needed a minus sign. I think that is because FP y direction is opposite what you intuitively think on the pinball table..... The y values are greatest at the flipper end of the table

So with billiards we just plug in the desired ball trajectory number which is actually the same as the rotation of the pool cue.
We can arbitrarily assign a desired ball speed based on how far the cue is pulled back.

And Voila the cue ball will roll in the direction we want, at the speed we want !

2. Plunger and flipper and kicker boosts where the ball is already in motion, we simply stay with the left side of the equations
BAM already monitors these values so we can just plug them in .
ball.SetVelocity Velocity.x, Velocity.y, 0



So if you want to boost the ball by a factor of two, it is very simple:
ball.SetVelocity 2*Velocity.x, 2*Velocity.y, 0

And Voila , the ball will be boosted in the path of its current trajectory.


Not the math to end all math ....but it is kinda of cool.
 
Last edited:
Forum activity
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.
      Mibs Mibs: StevOz has posted a new reply in the thread "(mis)Adventures in Cooking".
      Back
      Top