Superfluous‎ > ‎Experimentation‎ > ‎

XNA Crazy Balls!

This is a project I put together for the Computer Science open day at Royal Holloway, University of London (where I work). It was essentially a 3d physical simulation using simple Euler Integration to interpolate the new position of objects taking into account the forces acting on them (friction, gravity, etc) and their respective velocities. I've attached the original "challenge" sheet I set the students!

Naturally some limits were imposed in the system such as balls bouncing off each other and the imaginary walls. Of course the techniques I used were far from perfect and it would be possible in some rare cases for the balls to get stuck into each other. Problems with animation and intersection checking are always a great thing to show students.

Controls:
WASD (movement)
ZX (zoom)

This is how the project started (just in 2d), the students would modify the physical system i.e. change the mass or size of the balls. As soon as they changed the size of the balls a heavy small ball could bang into a light big ball and propel it up into the third dimension!

Students could then add a universal force of gravity pulling all the balls in one direction or towards a certain point. 

Here are two screen grabs of a modified version which implements Newtonian gravity (which models an attractive force between all of the balls). As soon as the app starts you see galaxy forming which can often look like a spiral (just like our own Milky Way Galaxy). I have included both versions at the bottom of the page.





Ċ
Tim S,
14 Jun 2010, 18:26
ċ
CrazyBalls_Fixed.zip
(315k)
Tim S,
14 Jun 2010, 18:30
ċ
CrazyBalls_GravitySimulation.zip
(313k)
Tim S,
14 Jun 2010, 18:30
Ċ
Tim S,
15 Nov 2010, 10:07
Comments