Click to See Complete Forum and Search --> : Projectile
Shell
Oct 21st, 2002, 01:47 PM
Hi everyone,
I'm just fooling around with vb right now, and i wonder if anyone knows how to make projectiles. I'm talking about a tank, shooting a projectile at a speciefied angle and with a speciefied power, how would i calculate the positions for this projectile?
Thanks in advance,
-Shell-
Peter1
Oct 21st, 2002, 02:04 PM
Hi.
Have a look at this piece of code that i did, to rotate things and go in the same direction.
http://www.vbforums.com/showthread.php?s=&threadid=193280
Pete.
Shell
Oct 21st, 2002, 02:34 PM
That helped, thanks!
But I still need to know something, how to add gravity so the projectile always ends up on the ground?
-Shell-
Peter1
Oct 21st, 2002, 02:39 PM
At a guess, though i'd have to fiddle with it a bit. You would have to see that when the projectile gets to a certain point/height then add a little value onto the 'DipY' variable each time. That (I think) should make it arc down.
Pete.
Sastraxi
Oct 21st, 2002, 04:14 PM
I didn't take a look at Pete's code, but if he's using a vector you can simply rotate that, until it's at 180 degrees (or hits the ground). You might need a more flexible way if you plan to add wind, such as a vector base but translating it into a speedX/speedY type thing.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.