I used the spring equation F = -k * x where k is the spring constant and x is the difference between the length of the spring at rest and the current length of the spring.
try this- it's cool!! (do it all at the same time)
set gravity to -50
set air resistence to 0
set friction to 1
set restitution to 1
set spring length to 0
set spring costant to 2.1
Well you could do "change y by -1 x gravity variable". You know, -1 multuplied by anything is changing it from positive to negative or other way around. I use it in my calculator!
BATzerk: Newton's method is used for a wide range of calculus approximations. The specific one that I mentioned was Newton-Raphson that was used to calculate a square root. I only did that because at the time I didn't know the ins and outs of scratch and could have done that part with a "distance to" block.
BATzerk: The only thing that makes this seem complicated is because I expose a lot of variables. It's also a little confusing because two of the alter how the balls bounce off of the side of the screen.
ALSO--(sorry for totally posting so much, haha! I'm just an avid fan of your projects!)--the whole "I want to get the square root of something" was also something that bugged ME. Until I realized I loved calculus and made this: (link to project) Is this similar to how you did it? (Idk; I used Newton's method thingy, and I heard you mention something about Newton. I assumed this was the only way to calculate square roots in Scratch... apparently not...) And I'll just finish this off by saying that YOUR PROJECTS ARE AMAZING!! XD
As for the velocities of the balls being affected by mouse movement, I recently created a little simulation to do just that. (link to project)
...And I'll also be honest when I say I REALLY don't get how you make spring constant and spring length SEPARATE entities. Maybe I'll try and make my own some day with those variables... (if I can...)
Simply spectacular. Check this out: (link to project) I created it from scratch (as in without first analyzing the code of this project, which is phenominal, as you know, by the way); it's a much more simplified version of this. I also created a 3D version, which I'm currently working on finalizing... it's a bit laggy, so I'm worried about how it'll run on the site...
The code can be a bit hard to follow since I put a Newton-Raphson integrator in the middle of the program to calculate square roots. It's mostly just simple physics calculations for force, acceleration, velocity, and displacement. I've always loved the simplicity of Newtonian physics.
Whoa, I can't believe I had a program that made it into the featured projects section. I appreciate all of the comments. I had really thought about adding more variables such as ball mass, spring dampening, compression spring constant, tension spring constant, and velocity based on mouse movement.
Thanks. I always like making programs that are more toy than functional. Responsiveness and ease of use always makes the programs just a little bit more fun to play with.
Thanks. I always like making programs that are more toy than functional. Responsiveness and ease of use always makes the programs just a little bit more fun to play with.
I've inlined the square root calculation so the simulation runs much faster. Adjust delta time to set the coarseness of the calculations.
Things for you to try out:
1. Turn the gravity really low and see what happens.
2. Set the spring constant to 0.
3. Set friction to 1.
4. Set the restitution to 0.
5. See what air resistance does to the oscillations.
6. Set the spring length to a really small number and pull the two balls apart.
This is a simulation of two masses connected by a spring.
Things for you to try out:
1) Set the gravity really low and see what happens. 2) Set the spring constant to 0. 3) Set friction to 1. 4) Set the restitution to 0. 5) See what air resistance does to the oscillations. 6) Set the spring length to a really small number and pull the two balls apart.
Comments
You need to be logged in to post comments
Add a Comment
I just LOVE such thigs - minimum of objects and scripts, maximum fun and insight! Thanks
That's great physics! I'm a little too young to understand how you did it, but very interesting!
that's pretty cool. how'd you get the rubberband effect goin there?
I used the spring equation F = -k * x where k is the spring constant and x is the difference between the length of the spring at rest and the current length of the spring.
something is a miss. your gravity is wrong.
cul
nice. if your interested in the enigma of physics check out this project. it simulates some really strage concepts... (link to project)
cool
Like, like like! The physics is great stuff, and all the options make for some cool experiments. Well done.
hmmmm
try this- it's cool!! (do it all at the same time) set gravity to -50 set air resistence to 0 set friction to 1 set restitution to 1 set spring length to 0 set spring costant to 2.1
boring
It wasn't a matter of not being able to, it was to be consistent with Scratch's coordinate system.
Well you could do "change y by -1 x gravity variable". You know, -1 multuplied by anything is changing it from positive to negative or other way around. I use it in my calculator!
That depends on your reference. Since Scratch uses positive as up I allowed the sign of the value to denote that positive is up and negative is down.
Ya you did it wrong, it is sopposed to be the higher the gravity the lower it goes.
Nice, reminds me of an old game, E-motion
BATzerk: Newton's method is used for a wide range of calculus approximations. The specific one that I mentioned was Newton-Raphson that was used to calculate a square root. I only did that because at the time I didn't know the ins and outs of scratch and could have done that part with a "distance to" block.
BATzerk: The only thing that makes this seem complicated is because I expose a lot of variables. It's also a little confusing because two of the alter how the balls bounce off of the side of the screen.
ALSO--(sorry for totally posting so much, haha! I'm just an avid fan of your projects!)--the whole "I want to get the square root of something" was also something that bugged ME. Until I realized I loved calculus and made this: (link to project) Is this similar to how you did it? (Idk; I used Newton's method thingy, and I heard you mention something about Newton. I assumed this was the only way to calculate square roots in Scratch... apparently not...) And I'll just finish this off by saying that YOUR PROJECTS ARE AMAZING!! XD
As for the velocities of the balls being affected by mouse movement, I recently created a little simulation to do just that. (link to project) ...And I'll also be honest when I say I REALLY don't get how you make spring constant and spring length SEPARATE entities. Maybe I'll try and make my own some day with those variables... (if I can...)
Simply spectacular. Check this out: (link to project) I created it from scratch (as in without first analyzing the code of this project, which is phenominal, as you know, by the way); it's a much more simplified version of this. I also created a 3D version, which I'm currently working on finalizing... it's a bit laggy, so I'm worried about how it'll run on the site...
I don't mind.
Canthiar, this looks like a great base for a game. Mind if I use it in one?
Wow.
Wow. No, I mean really wow. As in like, wowwowwowwowwow.
its just weird u got all these ideas and intell inside 1 little brain!!!
Cool.
Incredible workings with science. Hands together for you again!
THIS IS AWESOME!!!!!!
Restitution and friction describe the surface. Restitution is bounciness. Friction is scratchiness.
u use hard words and i have NO IDEA what ur talkin about?!
daniepeep dont worry youll understand when you are my age cos i've dun it in class. i'm 11 yrs old...
its cool
DaniePeep, friction slows down the movement touching one of the sides. The spring constant is how strong the spring is.
What do friction and constent mean? I'm only 6!
Wow! This is the best phisic/science simulation ever!
coooooooooooooooooool.
YOU DA MAN! this is one of the best programs I have ever seen. Editing Earth gravity is cool!
That is SO cool!!!!
The code can be a bit hard to follow since I put a Newton-Raphson integrator in the middle of the program to calculate square roots. It's mostly just simple physics calculations for force, acceleration, velocity, and displacement. I've always loved the simplicity of Newtonian physics.
Whoa, I can't believe I had a program that made it into the featured projects section. I appreciate all of the comments. I had really thought about adding more variables such as ball mass, spring dampening, compression spring constant, tension spring constant, and velocity based on mouse movement.
the programming is all greek to me
Wow. Nice use of physics and math. This is the most impressive program I have seen so far in scratch!
this is the best fing like that I have ever seen
How do you do that, changing the physics and everything? I have never seen anything like that on Sctratch 1.1. Where do you find all this?
wow
this is so cool im adding it to my favorites
This is great. Load to experiment with and discover.
Sweet. Heres someone who pays attention in his physics lessons!
Anyone who dismisses Scratch as having no use beyond simple animations needs to see this program. Fascinating fun physics. Excellent
good job
good jod i love it
this is great, well done!
Impressive.
Brilliant game. Shows a lot of science. I like science!
Thanks. I always like making programs that are more toy than functional. Responsiveness and ease of use always makes the programs just a little bit more fun to play with.
Thanks. I always like making programs that are more toy than functional. Responsiveness and ease of use always makes the programs just a little bit more fun to play with.
Wow, thats pretty awesome. Physics simulation in a simple drag and drop format. Awesome work!
I've inlined the square root calculation so the simulation runs much faster. Adjust delta time to set the coarseness of the calculations.
I've inlined the square root calculation so the simulation runs much faster. Adjust delta time to set the coarseness of the calculations. Things for you to try out: 1. Turn the gravity really low and see what happens. 2. Set the spring constant to 0. 3. Set friction to 1. 4. Set the restitution to 0. 5. See what air resistance does to the oscillations. 6. Set the spring length to a really small number and pull the two balls apart.