mariotor,
Look back at my first comment, it explains how this project was done. The concept is hard to desribe in words, but it really isn't difficult to do. (I'm an engineer, and need a pencil and paper to communicate effectively.)
The same idea was used for the "MoonLander" project.
Hi EdnaC! I love your project! How did you do it? Did you use the X and Y scripts to help you make the projectile move and did you use broadcasting to help you along with move step scrips? Any way great project! :)
You may want to have a look at "ProjectilePhysics". That one uses trig (and the classic physics equations).
There are also some good demos out there that help to explain trig. There a quite a few projects that "emulate" trig by using a guide sprite that goes to the origin and moves by "one" in the direction of interest. That guide's x and y position then report the sine and cosine of the direction.
And now that I've figured the guide sprite out, I finally discocer that Scratch does have Trig in it. Who'd have known it's hiding in the squareroot script?
I'm glad it helped. When this was made, Scratch had just gotten trig, and I'd gotten used to doing without. Trigonometry is very useful for many things, but confusing if you haven't had some "schooling" in it. For projectile motion, a guide sprite works really well, and it's pretty easy to see what is going on; send the guide in the direction you are heading, then have it move in the direction that gravity is pulling, and finally, point toward the guide and go to where the guide is, then repeat. The result of the "time step" simulation in this project is the same as the "real" physics equations. The difference is that the equations can predict the highest point and the impact distance without "simulation" of the entire flight.
Thanks for this. I could not figure out how to do a program like this without using the trig functions.
Download this project!
Download the 5 sprites and 8 scripts of "Projectile" and open it in Scratch
Project Notes
How to fire and track the position of a projectile using a "Guide" Sprite to keep track of the velocity and direction of the projectile.
Wind could easily by incorporated by adding a move to the guide sprite's script (change x by "wind effect").
Comments
You need to be logged in to post comments
Add a Comment
dude. wow. i could never figure it out. i have a tank game that uses imperfect projectile motion. im gonna fix it up and give u some credit.
truthfully, i'm jealous i didn't figure this out; it's so simple yet works so effectively.
this is incredible. i mean seriously. and that means a lot
mariotor, Look back at my first comment, it explains how this project was done. The concept is hard to desribe in words, but it really isn't difficult to do. (I'm an engineer, and need a pencil and paper to communicate effectively.) The same idea was used for the "MoonLander" project.
Hi EdnaC! I love your project! How did you do it? Did you use the X and Y scripts to help you make the projectile move and did you use broadcasting to help you along with move step scrips? Any way great project! :)
You may want to have a look at "ProjectilePhysics". That one uses trig (and the classic physics equations). There are also some good demos out there that help to explain trig. There a quite a few projects that "emulate" trig by using a guide sprite that goes to the origin and moves by "one" in the direction of interest. That guide's x and y position then report the sine and cosine of the direction.
And now that I've figured the guide sprite out, I finally discocer that Scratch does have Trig in it. Who'd have known it's hiding in the squareroot script?
I'm glad it helped. When this was made, Scratch had just gotten trig, and I'd gotten used to doing without. Trigonometry is very useful for many things, but confusing if you haven't had some "schooling" in it. For projectile motion, a guide sprite works really well, and it's pretty easy to see what is going on; send the guide in the direction you are heading, then have it move in the direction that gravity is pulling, and finally, point toward the guide and go to where the guide is, then repeat. The result of the "time step" simulation in this project is the same as the "real" physics equations. The difference is that the equations can predict the highest point and the impact distance without "simulation" of the entire flight.
Thanks for this. I could not figure out how to do a program like this without using the trig functions.