Pinball - The Basics?

mnajera
Unregistered
 
Post: #16
unknown Wrote:mnajera nice particle effects thing looks really cool,
Similar to what I said too:
You can try it out for yourself here:
physTest.zip . The three different colored particles fall from the top, and you can drag the endpoints of the lines to whereever you want to create a relaxing waterfall of color.

(Only "well-defined" collisions count, meaning that the start and endpoints have to be clockwise... or something.)

Please let me know if this program doesn't work on your machine!
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #17
Because someone was thinking outside the box you need to invert the y axis of the mouse location. They decided to make the coordinate system the same as the standard maths one and not the tried and tested origin at top left, I dont understand why but it sucks because it makes portabilty awkward and graphics programming more confusing.

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
mnajera
Unregistered
 
Post: #18
unknown Wrote:Because someone was thinking outside the box you need to invert the y axis of the mouse location. They decided to make the coordinate system the same as the standard maths one and not the tried and tested origin at top left, I dont understand why but it sucks because it makes portabilty awkward and graphics programming more confusing.
Well, I thought you only had to invert (or NOT invert) the y coordinates in fullscreen (or NOT fullscreen) mode. But, did the program run okay otherwise? Here's a quick inverted version:
physTestInvert.zip .

Also, the "B" key toggles bounds checking. With bounds checking enabled, a simple box-to-box test is performed for each particle to each line, and the program doesnt perform the full line collision test for boxes that don't collide, making it much faster, but straight line collisions aren't detected.
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #19
That works like a charm, Why dont you extend the bounding box of the particles used by the velocity so that they do. It will mean a couple more checks per frame but you wont get any particles going through lines.

[Image: boxy.jpg]
So those 3 stray particles that went through the line dont occur.

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
mnajera
Unregistered
 
Post: #20
unknown Wrote:That works like a charm, Why dont you extend the bounding box of the particles used by the velocity so that they do. It will mean a couple more checks per frame but you wont get any particles going through lines.
That might work, along with forcing the condition that a bounding box always extends a few pixels beyond the "real" box.

This kind of thing is important (going back to the original pinball discussion) because instead of lots of particles colliding with a few lines, you would have one particle (the ball) colliding with the hundreds of lines that make up the pinball table.

The other big problem occurs at the endpoints and intersections between the two lines. Try collecting some of the particles in a cup, and see what happens at the edges. A collision against one line will sometimes place a particle behind another line.
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #21
The error is most obvious with a very acute cup, you could fix that slicing time into sections until you have the exact time (with some slight unceartainty) of the collision, then doing the bouncing code from that time and then integrating the rest of the frame (allowing for more collision test so you can have several per frame, watch this though you might want to have a maximum collision per frame incase you get stuck in an infinite loop).

Also there is too much friction or they dont keep thier origional velocity after collisions so you cant make a curved ramp that they jump out of at the end.

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Moderator
Posts: 771
Joined: 2003.04
Post: #22
unknown Wrote:haha you fooled me!
http://newtondynamics.com is an open source physics library, kinda tricky though havent really got the hang of it yet.. soon though, once ive done all this other stuff.

Nope, not open source, just free.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Collision detection for pinball game johncmurphy 0 4,757 Sep 6, 2009 02:46 PM
Last Post: johncmurphy
  OSX basics LWStrike 4 2,632 Apr 27, 2006 12:48 PM
Last Post: LWStrike