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 Professional Discussion / Arching bullet shot?

Author
Message
Sealegs
20
Years of Service
User Offline
Joined: 9th Jul 2004
Location: Caribbean
Posted: 10th Aug 2004 03:18
I am trying to figure out how to make bullet arch (in 3d) as if it were shot form a cannon or catapult. (I would like the bullet to move pretty slow so you can watch it) Anyone got a code or a suggestion of how i might accomplish this?
-Sealegs

These be cursed waters...
BiggAdd
Retired Moderator
20
Years of Service
User Offline
Joined: 6th Aug 2004
Location: != null
Posted: 10th Aug 2004 04:10
This code is not mine! It was created by Phealax and its just what your looking for!
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 10th Aug 2004 04:13 Edited at: 10th Aug 2004 04:14
Try this. I wrote it a couple of weeks ago.


You can alter pretty much any factor I could think of which would affect projectile motion - but for a bullet you'll probably want to get rid of lift (usually due to backspin of a ball). Obviously you can change the camera angle to make it first person if you want.
zircher
22
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 10th Aug 2004 04:13 Edited at: 10th Aug 2004 04:15
You can apply 'gravity' to each shell by adding a negative value to the Y axis each loop. For example, let's say you rotate the shell to 45 degrees pitch and set shellGravity to zero. When you fire, you use the MOVE OBJECT command to move it relative to the shell's current position. After the shell is moved, subtract shellGravity from the shell's Y position and re-position the shell, increment shellGravity, and repeat until the shell collides with the ground.

Of course, you could get hard core and use either the Newton or Tokamak physics libraries as well.
--
TAZ


LOL, three answers in three minutes.

"Do you think it is wise to provoke him?" "It's what I do." -- Stargate SG-1
Sealegs
20
Years of Service
User Offline
Joined: 9th Jul 2004
Location: Caribbean
Posted: 10th Aug 2004 05:03
Wow thanks alot guys...This should help out alot!
-Sealegs

These be cursed waters...
Doom weaver
20
Years of Service
User Offline
Joined: 5th Jul 2004
Location:
Posted: 10th Aug 2004 15:20
Can't you just xrotate (i think its x axis) a little every loop and move the bullet in teh direction its facing, and make it slow down a little every loop as well? That way it will go almost strait for a while and towards the end slow down and drop off.
zircher
22
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 11th Aug 2004 00:50
You could, but X rotate only works in one plane and does not take gravity (real or game gravity) into effect. Also, when you rotate the launcher on the Y axis, the probelm now becomes much more complex. The beauty of MOVE OBJECT is that it works in side scrolling or 3D environments and all the maths are done for you.

Also, if you have a tumbling projectile, rotation along would not be a viable option. (Say you're building a CATapult...)
--
TAZ

"Do you think it is wise to provoke him?" "It's what I do." -- Stargate SG-1
The Real 87
21
Years of Service
User Offline
Joined: 3rd Mar 2004
Location: somewhere between 86 and 88
Posted: 11th Aug 2004 03:27
Let me guess Sealegs is re-doing Scorched Earth and he wants us to all help him win.

Sealegs you have another two months to finish your program, figure it our for your self, or get another programmer and make a team. I am making my own aching equasions and wind/gravity effects, and I suggest you do the same.

Check out my RPG at
www.stickz.tk
zircher
22
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 11th Aug 2004 06:13
Well, there is also some variations that could use wind in other ways such as an age of sail game with a Scorched Earth style combat system.
--
TAZ

"Do you think it is wise to provoke him?" "It's what I do." -- Stargate SG-1
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 11th Aug 2004 07:23 Edited at: 11th Aug 2004 07:27
Quote: "figure it our for your self, or get another programmer"


What a shame - I've been programming for a few weeks now, and the help I've had from people in this forum has been outstanding. It's the first time I've come across a 'figure it out for yourself' type response to somebody's question. The code I wrote above was based on what I learned here so I'm more than willing to pass it on.
The Real 87
21
Years of Service
User Offline
Joined: 3rd Mar 2004
Location: somewhere between 86 and 88
Posted: 11th Aug 2004 07:49
I only said that cuz he is using this game in a compo, I think it is only right for the code to be 100% his.

Check out my RPG at
www.stickz.tk
Don Malone
22
Years of Service
User Offline
Joined: 27th Apr 2003
Location: Birmingham, Alabama
Posted: 11th Aug 2004 08:44 Edited at: 11th Aug 2004 11:14
No more help until the end of the contest.....


sounds a bit silly when I say it.



Just kidding in case it is to subtle.

Wasting CPU Cycles since the 286 was a hot machine.
Sealegs
20
Years of Service
User Offline
Joined: 9th Jul 2004
Location: Caribbean
Posted: 11th Aug 2004 09:20
Everone is a beginner at sometime and this forum is one of the reasons that make DBPro so great... And i can honestly say that I have learned more from people on these forums then i have from the instruction booklet and tutorial...Thanks for making these forums great and helping people like me...so in the future I too will be able to help others...
Thanks again
-Sealegs

These be cursed waters...
Don Malone
22
Years of Service
User Offline
Joined: 27th Apr 2003
Location: Birmingham, Alabama
Posted: 11th Aug 2004 11:14
You are right about this forum being better than the manual as far as useful information and help. All someone has to do is be specific, show an effort to do the work and not flooding the forum.

And I have yet to see someone turned away when they have basic questions or need some help even during the comps. No one is going to finish your game for you but they will help as long as they can without overly effecting the comp.

Wasting CPU Cycles since the 286 was a hot machine.

Login to post a reply

Server time is: 2025-06-05 20:07:32
Your offset time is: 2025-06-05 20:07:32