Math problem

tinfoil

Banned
OK JustPlainPoliticers, I've got a tough math problem.
I need to write a script to handle collisions for a pinball game.
I need the help of knowledgable mathletes to make sure I have the math right before I get to scripting.
This what I have so far. Are my terms correct and is my theta calculatin correct?
Assume the ? is the leading edge of the ball with respect to the collision with the paddle. The paddle is going to be assumed to move faster than the ball so the position at the time of triggering is the collision point for the ball. the leading edge tangent intersection is the collision point. The vector normal is perpendicular from the paddle angle.

97kv81.jpg


Does this even make sense? LOL
 
I don't think the vector will always be perpendicular to the paddle arm. the angle and speed of the ball must be taken into account.

But I could be wrong.
 
I don't think the vector will always be perpendicular to the paddle arm. the angle and speed of the ball must be taken into account.

But I could be wrong.

the vector is for the ball. the paddle vector is going to be ignored because the paddle move so fast it's easier to treat the point the ball is at when the flipper is pressed as the point where the flipper will meet the ball, or the collision point. The angle of the ball leaving the paddle is symetrical with respect to the incoming angle to the perpendicular angle to the paddle, or the vector normal.

I think this is correct, but I'm asking someone who really knows this stuff.
 
no way! Mottley dude knows math. Damo knows math and Dano too.
I'm pretty sure the math is correct anyway. think about it. If the angle of impact is perpendicular to the paddle face, or a square hit, theta = 0 and the rebound angle = the incoming angle and the direction is reversed. If the angle of impact is 45, the rebound is 45.
 
what I need to figure out is how to calculate the grey area labeled field of contact. That's the test that will trigger wether the flipper can hit the ball. If the ball is nowhere near the flippers, I don't want to test for a collision with the paddles.

So if the flipper is triggered, I test to see if the ball is in that zone. if it is, the flipper moves so fast, I'm going to take the ball position, calculate the angle from the ball's leading edge to the fulcrum of the paddle and consider this the angle of flipper contact. Ill take that point(tangent circle to that angle)and calculate the normal which is that angle + 90. Next the new directions are figured and the ball and flipper are moved at the same time so it looks like the flipper moved really fast and hit the ball. It's javascript and the frame rate is ridiculously slow. I have the timeout set at 70 ms. It's a wonder this game even looks decent. I really rhink it will be cool when I'm dne with ti.

I WILL FIGURE THIS OUT!!!!!!
I'm stirfry, if I believe I can do it, I will find a way to do it.
 
So the ball will have no rotational energy when it impacts the flipper which will effect it's subsequent path?
 
So the ball will have no rotational energy when it impacts the flipper which will effect it's subsequent path?

I think you're getting too complicated. It's just a 2 dimensional animation so the ball rotation is not used, just it's position and velocity. The red line is the ball velocity and direction, or vector.

here's the math problem. How do I calculate the yellow area?
1zld3si.jpg
 
Des anyone remember the leverage math? I know the force delivered to the ball increases exponentially, but I've forgotten the formula.
 
Am I seriously the only person who's had physics training on this board? I find that hard to believe. You guys have to know this stuff.
 
Why am I asking? So one of the smarter people can catch my mistakes before I waste time writing this complicated piece of code. I guess I was hoping one of the engineers here could at least set me on my path to finding the info. You guys are my collective brain. I derive valuable information from you people!
Oh and,
I can't find anything using google. leverage keeps turning up economics stuff.
sifting through physics stuff for the formula is gona take me forever! LOL

Back to google.
Even the programers at ozone are having a tough time with this.

One guy, a very well known programer called poi, suggested I use a distance function to check for collision. hehe, I think I know what he means, but I was wondering if anyone here understod what that means. lol for me it's just a matter of not knowing what the term means at this point.
I appreciate everyone's help
 
Last edited:
OK JustPlainPoliticers, I've got a tough math problem.
I need to write a script to handle collisions for a pinball game.
I need the help of knowledgable mathletes to make sure I have the math right before I get to scripting.
This what I have so far. Are my terms correct and is my theta calculatin correct?
Assume the ? is the leading edge of the ball with respect to the collision with the paddle. The paddle is going to be assumed to move faster than the ball so the position at the time of triggering is the collision point for the ball. the leading edge tangent intersection is the collision point. The vector normal is perpendicular from the paddle angle.

97kv81.jpg


Does this even make sense? LOL

The main advanced math I've done in programming is with encryption, you're looking for more graphics related math with moving objects along x,y values. Nothing I've touched since college.

I did find this, parts of it may have what you want.
http://www.ticalc.org/archives/news/articles/9/91/91883.html?p=2

If not, your best bet is to just scour the net, enter in Javascript, pinball, angle, velocity and related keywords and see what you can find with that.

When you say script, I'm assuming you mean Javascript because I know you use that a lot, most games like that are done in Flash but if you're set on doing it in Javascript then when you do find code for it on the net, it's easily copied and you can change it to what you want.
You're a smart guy but there's no need to reinvent the wheel, someone out there has already written this, so act like the Japanese and get your hands on it and change it to what you think is better.
 
Why am I asking? So one of the smarter people can catch my mistakes before I waste time writing this complicated piece of code. I guess I was hoping one of the engineers here could at least set me on my path to finding the info. You guys are my collective brain. I derive valuable information from you people!
Oh and,
I can't find anything using google. leverage keeps turning up economics stuff.
sifting through physics stuff for the formula is gona take me forever! LOL

Back to google.
Even the programers at ozone are having a tough time with this.

One guy, a very well known programer called poi, suggested I use a distance function to check for collision. hehe, I think I know what he means, but I was wondering if anyone here understod what that means. lol for me it's just a matter of not knowing what the term means at this point.
I appreciate everyone's help
Unfortunately I am working. Which means I have numbers running through my head for one purpose. Words are fine, but adding more numbers means I will make mistakes in the ones needed for the job....

;)

I'll see what I can see when I am not at work.
 
oh yeah Damo, no rush, just a little project I'm working on. I'm actually just wondeing if the math looks correct. I'll be able to handle the javascript already.

Dano, I like your idea of snagging a script, but I assure you, I've googled the hell out of every possible keyword you could imagine. The running script for the pinball test is one result. LoL. This is going to be the first time someone has attempted this in javascript. The only other pinball I've seen is in java, which I have no programing experience in, just switching parameters and stuff.
Do you know if action script is similar to javascript? Same kind objects? I jknow injavascript, a function can be an object. my understanding of objects and functions might be all messed up because of this. LoL

I'm going to look for some action script pinball and see.

Thanks guys
 
Back
Top