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.

DarkBASIC Discussion / Grenades-??

Author
Message
MrNick
21
Years of Service
User Offline
Joined: 23rd Feb 2004
Location:
Posted: 25th Feb 2004 22:20
I'm interested in how you can make a trajectory for grenades in db. Can anyone tell me-????

hey yo
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 25th Feb 2004 22:55
It will require very advanced physics to make a real grenade throwing simulation. You will have to take into account your forward movement, speed and gravity. You will have to mathematcially calculate the curve of the grenades fall. Youll have to use the gravity agrothim and probably a bit of SIN COS and TAN functions to figure out a path of travel.


We need help! Email us! [email protected]
ReD_eYe
22
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 25th Feb 2004 23:01
or use move object and xrotate object that gives an ok look once you get the values right

In the beginning, the universe was created...
This made alot of people very angry and it has been widely regarded as a bad idea...
Visit http://redeye.dbspot.com
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 26th Feb 2004 03:32
@ReD_eYe, Yeah, you could use that, but then the path of the object would make out a circle, where the projectile path of an object in the real world traces out a parabolic curve.

The best way would be to break the movement up into two components, vertical and horizontal.

The horizontal component is ALWAYS constant for any projectile.
The vertical component will increase/decrease with the efects of gravity. Ie, it will have a downward acceleration.

If you set the initial upward velocity of the object to something of the order of 5 ( ie, it would move 5 units in the vertical component each loop ) and set the gravity to 1 to start with. You can then easily use simple checks to change the vertical velocity.

If you want, you can change the angle of projection, and then work out the vertical and horizontal initial velocities based on the initial velocity of the object... This is best descibed with a picture;



You would then use Uh ( Initial Horizontal Velocity ) As the contsant horizontal movement each loop.

Then use Uv ( Initial Vertical Velocity ) Along with your variable for Gravity ( You'll just have to test that to see what works best in your program ) to work out the height of the object along its path.

To do this, use something like this;



That might not be too easy to understand, but that's the physics of it all.

Hopefully you can turn that into a function and create a good looking projectile exapmle

Hope I Helped...
Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 26th Feb 2004 04:35
I know TheDarthster made a WICKED awesome car flip demo (rolled down a hill) so many he could help you out a bit with physics.


We need help! Email us! [email protected]
Night Giant
21
Years of Service
User Offline
Joined: 26th Jul 2003
Location:
Posted: 26th Feb 2004 06:34
wasn't this discussed very recently? like here: http://darkbasic.thegamecreators.com/?m=forum_view&t=26430&b=10

oh, wow. insignificantpunks.cjb.net. we like orange treble clef notes, just for future reference.

no: website for progs yet.
MrNick
21
Years of Service
User Offline
Joined: 23rd Feb 2004
Location:
Posted: 26th Feb 2004 14:33
Hey, what do you know... yes it was!

hey yo

Login to post a reply

Server time is: 2025-05-22 17:27:49
Your offset time is: 2025-05-22 17:27:49