Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Newton's Cradle Simulation

Author
Message
Ric
19
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 8th Aug 2004 09:22 Edited at: 8th Aug 2004 13:14
A reasonably accurate (I think) representation of Newton's Cradle. It's timer based with real life values of gravity, time and length - so you could actually adjust the length of the strings in the code, and the period of oscillation should be the same as that of a real pendulum. Not sure if this is likely to be useful in a game, other than to look pretty - but it should be useful in my classroom for teaching simple harmonic motion and conservation of energy. Plus, it could be a nice screensaver.

One problem though is the collision routine which means the balls sometimes fuse together partially - if anyone can improve on it then I'd be very grateful (prefably in the code rather than using a physics wrapper)





(tested in dBPro only)
DEANO
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United States
Posted: 8th Aug 2004 09:30
Ric, that's pretty cool .

"When I examine myself and my methods of thought, I come to the conclusion that the gift of fantasy has meant more than my talent for absorbing positive knowledge."
-ALBERT EINSTEIN
The Real 87
20
Years of Service
User Offline
Joined: 3rd Mar 2004
Location: somewhere between 86 and 88
Posted: 9th Aug 2004 16:46
nice, but instead of writing a 197 line code couldn't you go to the store and just buy one of those things?

Check out my RPG at
www.stickz.tk
Ric
19
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 10th Aug 2004 04:54 Edited at: 10th Aug 2004 04:56
LOL!! Of course I could, but the sad fact is that today's playstation generation of school children like computer sims of models more than their real life counterparts! Besides which, with this I can make it return real values of time, displacement, linear velocity, acceleration, kinetic energy, potential energy, frequency ....... and students can then see, or predict, how each variable affects each other variables as they change in real time. Kind of educational.

Login to post a reply

Server time is: 2024-04-20 00:27:46
Your offset time is: 2024-04-20 00:27:46