JavaFX Physics Demo

Tuesday, November 11th, 2008

In yet another fun JavaFX experiment, I hooked into the Phys2d physics library and created a little demo. This demo shows eggs falling down some alternating ramps at regular intervals. It is pictured below in action:

You can run the application for yourself via Java Webstart here.

UPDATE January 19, 2009: The source code is now available here.  Thanks to all who were interested. Enjoy!

I highly recommend checking this out.  It’s very satisfying watching the eggs fall and bump around off each other.

So this was originally going to be a game called “Good Egg” that my wife and I have had in development to be shown at a JavaFX talk that I’m giving next week.  The idea is that as eggs roll down the ramp they would roll in front of a light which would reveal the contents of the egg.  If the egg contained anything out of the ordinary (e.g. a baby dragon, or a paper clip), you’d have to track it to the bottom and push it off the assembly line without taking any good eggs with it.

The reason that I’m posting this now is that it doesn’t look like this will be done it time for the talk, however, in its current state it makes for a neat physics demo. I know what you’re thinking, and don’t worry –  I’ll just show Gears of War 2 at my talk and pawn it off as JavaFX.

As usual thanks to my wife for the artwork, and thanks to Kevin Glass for the Phys2D port.

Tags:

13 Responses to “JavaFX Physics Demo”

  1. Josh Marinacci wrote:
    November 26th, 2008 at 6:59 pm |

    This is very cool. I hope you don’t mind if I publish it on openjfx.org.

    Thanks,
    Josh

  2. sanderson wrote:
    November 26th, 2008 at 11:23 pm |

    Hi Josh,

    You’d be most welcome to republish this. I’d be honored. Let me know if you need anything.

    -Sten

  3. Olivier wrote:
    December 30th, 2008 at 7:47 am |

    Sten,

    Would you care to host the various JavaFX samples you’ve created on a server where everyone may get a chance to see them. I keep getting a Network Timeout and haven’t had the chance to see any of your creations and it’s becoming a real nuisance!

    Thank you for your understanding!

    Regards,
    Olivier

  4. sanderson wrote:
    December 30th, 2008 at 10:17 am |

    Olivier,

    Thanks for the suggestion. The demos are hosted on a personal machine, with limited bandwidth. I’ll see about moving them to a server with a fatter pipe.

    -Sten

  5. sanderson wrote:
    January 5th, 2009 at 11:12 am |

    The JavaFX demos have been moved to a different server with more bandwidth. Hopefully this will help those that were having trouble running them.

  6. allan wrote:
    January 9th, 2009 at 5:26 am |

    um just wondered about FX and want to ask if you wouldn’t mind to attach this project src code to help us growing in FX use applications, nice and very good creation.
    thank you very much

  7. sanderson wrote:
    January 13th, 2009 at 9:26 am |

    @allan: Thanks for the comment. I’ll try to get the source code in a postable state.

    -Sten

  8. Cam wrote:
    January 19th, 2009 at 7:49 am |

    Sten this is really great. How long did it take you to do. Eagerly looking forward to seeing the source code :)

    Cam

  9. sanderson wrote:
    January 19th, 2009 at 10:49 am |

    The source has been posted (see update above). Enjoy!

  10. Tahir wrote:
    March 9th, 2009 at 7:36 am |

    looking great are the eggs used as image??

  11. sanderson wrote:
    March 9th, 2009 at 1:53 pm |

    @Tahir — yes the eggs, ramps and background are all images (created by my wife in Adobe Illustrator). I believe they are included in the source zip posted above.

  12. dinesh wrote:
    May 24th, 2010 at 11:30 pm |

    It is really good thought and very nice.please forward the source code

  13. sanderson wrote:
    May 25th, 2010 at 8:49 pm |

    @dinesh — there’s a link to the source code about halfway down the post.

Leave a Reply