Register    Login    Forum    FAQ    PinSimDB.org

Board index » Future Pinball » BAM corner




Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Ball Tracking - How to get ball coords, speed.
 Post Posted: Tue Mar 29, 2016 4:38 pm 
Offline

Joined: Mon Mar 25, 2013 4:02 pm
Posts: 957
Now with BAM you can get coords of ball. Any time.

Demo table:
http://www.ravarcade.pl/files/ballTrackingDemo.fpt

On this demo table you have 3 bumpers with arrow texture on cup.
All 3 behave little different.
Bumper1 (left):
- When ball hit it, arrow will start to point at ball, until ball don't hit it again

Bumper 2 (right)
- Arrow will alway point at ball closest to that bumper

Bumper 3 (top):
- arrow will point to ball postition when ball hit it (only on _Hit() arrow will move).

How ball tracking works:
You have 2 way to get ball object:
1. When ball hit anything, when xBAM_Ball will be set to that ball. You can store that "ball object" for later use in variable. Code snipet:
Code:
Dim BallToTrace
Set BallToTrace = Nothing

Sub Bumper1_Hit()
    Set BallToTrace = xBAM_Ball
Sub End


2. Any time you can find ball closes to give point. If for example you have bump on coords X=100, Y=200, you can find ball closes to bumper with this:
Code:
Dim ball
Set ball = xBAM_BallCloseTo(100, 200)


Now importan thing: What to do with Ball object.
Ball object have 6 properties:
- Exist - [True or False]- Is True if ball is still on table. It will be = False if ball was destroyed or when you call xBAM_BallCloseTo and there is no ball on table.
- Speed - [float] - current speed of ball
- HitSpeed - [float] - speed of ball when it hit anything - use this value in _Hit() subroutine.
- Velocity - [3D Vector] - ball velocity 3D vector. Use it as: Velocity.X, Velocity.Y, Velocity.Z to get spped of ball in selected axis
- Position - [3D Vector] - X & Y are used same way as any object coords in FP editor,
- PositionGlobal - [3D Vector] - mini-playfields create small problem: If ball is on Mini-Playfield when coords readed from "Position" are outside of table. So PositionGlobal are coords of ball after translation to table coords. If it is not clear now, read more:

Why we need both: Position and PositionGlobal?
When you want to read ball coords in relation to object on table (but not on mini-playfield) use "PositionGlobal".
When you need coords in relation to object on mini-playfield, use "Position".

Well... in most case you will use only PositionGlobal.

Now go to my "ballTrackingDemo.fpt" and look at table. You will find in 3 places how i calc ball position in relation to bumper and how i calc angle for Bumper.rotation based on that position (see Atn2 function).
All is simple and only in few lines.

Have fun.

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


Top 
 Profile  
 
 Post subject: Re: Ball Tracking - How to get ball coords, speed.
 Post Posted: Tue Mar 29, 2016 5:00 pm 
Offline
User avatar

Joined: Fri Jul 02, 2010 4:50 am
Posts: 1178
Location: Paris - France
I had fun! Nice...
I wanted VelX, VelY in order to calculate the speed of the ball when it hit a target, a drop target. In a real pinball, you have to have a minimum speed in order to have a real Target_Hit (or DropTarget_Hit) and not have to just touch (even with a minimal speed) it.
And, but it just happens for two italians pinballs, you have special target with two gains depending the speed you hit it (normal hit and really big hit).
Just one (more) request. Could you add a variable (or part of script) in order to know if the table use BAM or not (to have just one script to write).
Excellent work as usual Rav!

_________________
Les cons ça ose tout. C'est même à  ça qu'on les reconnaît.
My tables avalaible at http://www.pinsimdb.org/fpreleases/ and http://www.irpinball.org/
Image
Image
Le prix s'oublie, la qualité reste


Top 
 Profile  
 
 Post subject: Re: Ball Tracking - How to get ball coords, speed.
 Post Posted: Tue Mar 29, 2016 5:03 pm 
Offline
User avatar

Joined: Fri Jul 02, 2010 4:50 am
Posts: 1178
Location: Paris - France
And you can code "real" magnet...

_________________
Les cons ça ose tout. C'est même à  ça qu'on les reconnaît.
My tables avalaible at http://www.pinsimdb.org/fpreleases/ and http://www.irpinball.org/
Image
Image
Le prix s'oublie, la qualité reste


Top 
 Profile  
 
 Post subject: Re: Ball Tracking - How to get ball coords, speed.
 Post Posted: Tue Mar 29, 2016 5:26 pm 
Offline

Joined: Mon Mar 25, 2013 4:02 pm
Posts: 957
[quote="Popotte"... Could you add a variable (or part of script) in order to know if the table use BAM or not (to have just one script to write).
Excellent work as usual Rav![/quote]
I will tomorrow add "fail safe" script. So don't worry.

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


Top 
 Profile  
 
 Post subject: Re: Ball Tracking - How to get ball coords, speed.
 Post Posted: Tue Mar 29, 2016 8:32 pm 
Offline
User avatar

Joined: Fri Jul 02, 2010 4:50 am
Posts: 1178
Location: Paris - France
Don't worry too, I'm not in an hurry...

_________________
Les cons ça ose tout. C'est même à  ça qu'on les reconnaît.
My tables avalaible at http://www.pinsimdb.org/fpreleases/ and http://www.irpinball.org/
Image
Image
Le prix s'oublie, la qualité reste


Top 
 Profile  
 
 Post subject: Re: Ball Tracking - How to get ball coords, speed.
 Post Posted: Wed Mar 30, 2016 8:50 pm 
Offline
User avatar

Joined: Sun May 08, 2011 4:57 pm
Posts: 1071
Location: Turin-ITALY
because the demo give me error at line 95.
undefined variable "xBAM_BallCloseTo"?
Thanks
Gianfranco


Top 
 Profile  
 
 Post subject: Re: Ball Tracking - How to get ball coords, speed.
 Post Posted: Thu Mar 31, 2016 1:05 am 
Offline

Joined: Mon Mar 25, 2013 4:02 pm
Posts: 957
franzleo wrote:
because the demo give me error at line 95.
undefined variable "xBAM_BallCloseTo"?
Thanks
Gianfranco

Did you updated BAM to last release?
Last is v1.4-124. BAM.dll from "beta" don't have this.

http://www.ravarcade.pl/files/BAM_v1.4-124.zip

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


Top 
 Profile  
 
 Post subject: Re: Ball Tracking - How to get ball coords, speed.
 Post Posted: Fri Apr 08, 2016 8:45 am 
Offline

Joined: Mon Jan 27, 2014 12:36 pm
Posts: 2703
Location: Ontario, Canada
i haven't looked at xml files etc....
But I was wondering what contol we have on ball spin?

Is it possible to have ball roll along its trajectory/path only
And remove any added side spin or rotational spin effect?

does the Ball in the pinball arcade spin?
It doesnt visually seem to....

I wonder if dampening spin effect would help with the Fp physics complaints that some have

Can you track and adjust spin?


Top 
 Profile  
 
 Post subject: Re: Ball Tracking - How to get ball coords, speed.
 Post Posted: Wed Apr 20, 2016 11:16 pm 
Offline

Joined: Fri Nov 22, 2013 8:25 am
Posts: 166
Quote:
does the Ball in the pinball arcade spin?
It doesnt visually seem to....


Yes they do :P

I have the Pro packs with the custom balls.
All of the balls spin.

The Adams family ball pack is especially nice.
These are oddities, different then the normal balls.
There a light bulb ball that lights on\off while playing.
Heads that 'walks' or only spins on one axis.
Balls that act as normal, but with extra animations of lighting and twisters.
Oh and lets not forget about THing, who is animated on top of one ball.


Quote:
Is it possible to have ball roll along its trajectory/path only
And remove any added side spin or rotational spin effect?


This would be a nice option

Quote:
Can you track and adjust spin?


I would also like ask if it would be possible to add a DMD HUD to the ball? Something that you can have float on top or overlay the ball giving added animation effects.

With this, balls like the ones in The Adams family ball pack could be made.

Would it possible to have a color that would make part of "269.bmp\334.bmp" invisible.


Thanks


Top 
 Profile  
 
 Post subject: Re: Ball Tracking - How to get ball coords, speed.
 Post Posted: Thu Apr 21, 2016 5:51 pm 
Offline

Joined: Mon Mar 25, 2013 4:02 pm
Posts: 957
I will add transparency support, but displaying DMD need too much work.

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


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

Board index » Future Pinball » BAM corner


Who is online

Users browsing this forum: flipper 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: