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 / How to fire object

Author
Message
Bloder
17
Years of Service
User Offline
Joined: 24th Feb 2007
Location: Cyberspace
Posted: 8th Jul 2009 21:46
Hi, me again!
Could someone help me?
I need a bit of code that lets me click anywhere on the screen in a 3d game and a small sphere will fly in that direction.

If I were you, I'd make a game...
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 8th Jul 2009 21:58
Is this a 3rd person view (camera follows the player from behind)or a 1st person view (camera is in the eyes of your player)?


Make the path of your enemies easier with Waypoint Pro!
Bloder
17
Years of Service
User Offline
Joined: 24th Feb 2007
Location: Cyberspace
Posted: 8th Jul 2009 23:36
It's 1st person view. Im making a FPMS (First Person Magic Shooter)

If I were you, I'd make a game...
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 9th Jul 2009 00:45


This is very basic, but you can build on it. For multiple bullets you need to make a counter system, so if you want to shoot, you keep picking the next bullet and shoot it, and if the counter reaches the maximum bullet number you reset it.

Also check out example 25 in your darkbasic folder in "tutorials\source".

TheComet


Make the path of your enemies easier with Waypoint Pro!
Brick Break
User Banned
Posted: 9th Jul 2009 05:25
Just to add to it, an easy way to make the bullet arc is to add gravity. I edited TheComet's with a couple improvements:


Permanoobs are awesome.
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 9th Jul 2009 06:21
Normally a bullet's arc wouldn't matter, unless it were a HUGE bullet or a LONG range shot.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Brick Break
User Banned
Posted: 9th Jul 2009 06:29
Quote: "LONG range shot."

Bingo. Keyword: BULLET

WINNER list:
Latch
Thanks for the help!
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 9th Jul 2009 11:05
Not necessarily.

Most bullets will hit something before they really arc noticeably. It takes a while for them to slow down to the point that they are actually effected by gravity.

I think snipers need to compensate a little, but for most modern guns that aren't snipers, it isn't a problem as far as I know.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Brick Break
User Banned
Posted: 9th Jul 2009 21:25 Edited at: 9th Jul 2009 21:27
@BN2- Just because gravity isn't noticeable doesn't mean it's not there. For example, say you shot a gun. Let's say the bullet traveled 500 m/s. Gravity still increases 9.8 m/s. So, in the time it took that bullet to go 1500 feet, it also dropped down 30. After 3000 feet it would have dropped down by 90. Now, how big is a game level? A kilometer maybe? Well, that gives one about 1/4 mile from the center of the map. That's about 250 meters, or 750 feet. By the time the bullet reaches the edge of the map, it would have already dropped a couple feet. If you shot from one corner of the map to the other, it might even drop up to 10 feet.
Now, let's look at another situation. Let's say the game is like Crysis, in that you can pick stuff up and throw it. Let's say you're throwing a ball, as in TheComet's example. If that ball is thrown at a force of 10 m/s, and gravity is about that, squared, then after 2 seconds it would drop significantly further than you threw it. Hence the "arc" shape. There is always an arc. Always.

EDIT: Well, except in space.

WINNER list:
Latch, Lee Bamber, TDK
Thanks for the help!
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 10th Jul 2009 02:58
BB i think you're looking at it the wrong way, the 9.8m/s is based off the time of flight, every one second of flight it would speed the descent by 9.8, so to figure the arc you need to figure the time it takes for the bullet to get from point a to point b, which even on a fairly long shot wouldnt be even a second

so get the velocity of the bullet then from that you could figure the arc

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 10th Jul 2009 03:11
I will let this one drop, since I can't seem to find the info anywhere, but somewhere in one of my physics classes I remember learning/hearing a reference to something to the effect that guns fire fast enough that gravity is negligible (probably due to curvature of the Earth). So in demonstrations, it was always added that the gun was either old (thus not firing fast enough) or just a note of: fired slow enough to be effected by gravity.

Either way, though, it is moot, since there will usually be very few occurrences in which a bullet will travel the full course of a map without hitting something.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Brick Break
User Banned
Posted: 10th Jul 2009 03:19
All I'm saying is, what goes up must come down. I don't like seeing stuff fly off into space. An example might be the projectiles in SoulHunter. Did you ever notice how no matter how slow a boulder moves, it kind of glides through the air without dipping down at all? It's a crying shame. Even particles are effected by gravity, so why not projectiles?

WINNER list:
Latch, Lee Bamber, TDK
Thanks for the help!
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 10th Jul 2009 03:36
They are, but I think there is a speed and mass relationship, where if you fire it, gravity becomes negligible until it slows down enough, but I can't seem to find it anywhere. With boulders and such, though, gravity is a must, I will NOT disagree there. Just with things like bullets, it seems like a waist of processor power (magic missle type things, though, would probably need gravity for realism)

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 10th Jul 2009 03:40
Quote: "@BN2- Just because gravity isn't noticeable doesn't mean it's not there."


LOL!!!!!!
Flamed.


Quote: "I remember learning/hearing a reference to something to the effect that guns fire fast enough that gravity is negligible "


Really? thats quite interesting. In fact, thats kinda cool.

Your signature has been erased by a mod because it was too big.CHANGE IT OR DIE!!!!!
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 10th Jul 2009 03:50 Edited at: 10th Jul 2009 03:54
Like I said, it could be that it is going so fast that the ground "drops" from under it due to curvature, and as it slows down the bullet will fall more than the Earth Curves.

Either that or it approaches escape velocity (where earth will never pull it down, though we know it doesn't hit that fast).

Again, not sure since I can't seem to find the correct facts.

If true, it probably stems from the fact that Newtonian Mechanics aren't right in very large or small numbers. For normal stuff, it is fine, but very fast objects and very small objects will sometimes break those rules. For instance, if two ships are flying toward each other at half the speed of light, from the point of view of one pilot, according to Newtonian Mechanics, he should be seeing the other pilot coming at him at the speed of light. That doesn't happen, though, as it is only about 3/4's the speed of light.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 10th Jul 2009 04:48
we need a "Game Physics" board for this kinda stuff

lol

Brick Break
User Banned
Posted: 10th Jul 2009 07:26
@That1Smart Guy- Game Design Theory

WINNER list:
Latch, Lee Bamber, TDK
Thanks for the help!
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 10th Jul 2009 08:03
*facepalm*
nice

Bloder
17
Years of Service
User Offline
Joined: 24th Feb 2007
Location: Cyberspace
Posted: 10th Jul 2009 10:51
Yeah, a game physics board would be good!

If I were you, I'd make a game...
Bloder
17
Years of Service
User Offline
Joined: 24th Feb 2007
Location: Cyberspace
Posted: 10th Jul 2009 11:07
Thanks, I will mention you in the credits of my game.

If I were you, I'd make a game...

Login to post a reply

Server time is: 2024-05-20 12:38:43
Your offset time is: 2024-05-20 12:38:43