Confined collisions with a dose of gravity

Date August 1, 2008 @ 1:42 pm in Microsoft, Silverlight

Over the past few months I have created a handful of Silverlight 2 examples that demonstrate basic physics. In this example I am going to demonstrate containment of a variable number of spheres with gravity causing deceleration.  Below you see a simple Grid which I will place a set number of spheres within.  Each sphere will be inserted into the grid at a randomized X position, within the top 20 pixels of the container.  Each sphere drop immediately and react to any collision with the container or other spheres elastically.

If you run this a few times you are bound to find it freak out. I am still in the process of tracking down why on a occasion it appears get lost and the spheres disapear.

Code: GravitationalCollisions.zip

/p>

3 Responses to “Confined collisions with a dose of gravity”

  1. Jon Jansson said:

    Hi Joel and thanks for this interesting demo. I’ve restarted the app with 26 spheres about 30 times now and I haven’t experienced the problems you’ve mentioned. It all works fine for me. I’ve tested it on WinXP, both FireFox 2 and IE7

  2. Silverlight Cream for August 10, 2008 -- #343 said:

    [...] Silverlight Video Player he and Tim Heuer put on CodePlex… and he makes this all look simple :) Confined collisions with a dose of gravity Joel also has this post on confined collisions … I saw this just before heading out on vacation, [...]

  3. Justin-Josef Angel [MSFT] said:

    Very cool stuff Joel!

    Too bad you didn’t use the farseer silverlight physhics engine though, it would have probably cut down the time needed to build this example.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">