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.

Newcomers DBPro Corner / sine waves

Author
Message
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 31st Jul 2004 09:44 Edited at: 31st Jul 2004 09:49
I am creating a program where you fire a cannon. I want the cannon ball to arc up at the angle that you set it to and fall based on wind and weather conditions (wind blows the shot to the side, hail shortens distance, etc.) I thought that I could use sine waves to acomplish this but I don't know how they work. PLEASE help me, I am using DBC.

thanks in advance
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 31st Jul 2004 10:11
2d or 3d?

"eureka" - Archimedes
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 31st Jul 2004 11:40 Edited at: 31st Jul 2004 12:07
Good Physics question! This is the sort of thing I would like to include in my 'virtual science lab' I'm dreaming up, so I've just written some simple code which might help both of us.

Basically, with projectile motion, it's easiest to split the motion up into seperate x, y, and z components, then think about what the motion will be doing in each of those directions. In the program below I've remarked pretty much every line so you should hopefully see what I've done and why. I've written it in DBpro, so I don't know if you will need to change anything to get it working in classic. I've included variables to affect air resistance (headwind) and crosswind.

Once it's running, control the initial angle (the trajectory) with the up and down arrow keys, and press space to fire the cannon.




Hope it helps - let me know if you want any further explanation of projectile motion.
Hepy
20
Years of Service
User Offline
Joined: 16th Apr 2004
Location: United Kingdom
Posted: 31st Jul 2004 20:52
wow thats amazing, helped me alot,
thanks hepy

Hepy
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 1st Aug 2004 05:25
http://www.thegamecreators.com/?m=codebase_view&i=777fb06425f39fec79c62a8fe2c17fab

posted that last year. look with the mouse, and throw an object through the air.

"eureka" - Archimedes

Login to post a reply

Server time is: 2024-11-27 03:52:42
Your offset time is: 2024-11-27 03:52:42