Page 1 of 1

A consideration on physics and projectile trajectories.

Posted: Tue Dec 12, 2006 1:29 am
by Bac-Talan
Warning:This post, and presumably the following topic, will be pretty math and other stuff heavy. That being said...


First of, this topic is going to have most to do with weapons and projectiles, just so you know.

Let me start of with this question: What path do bullets travel in?
A line? As represented by the Battlefront series? Wrong.
Bullets, and any other projectile of the sort (in a perfect mathmatical world such as a computer simulation:roll:) will travel in a parabola, or the shape a quadratic function makes when graphed:
Figure A:A parabola
Image
As we realize, the path a bullet makes would be much more stretched out, best represented by the equation (in the standard form of f(x)=ax^2+bx+c) is -16t^2+vt+h where -16 represents the acceleration of gravity, t represents time, v represents velocity and h represents initial height. Because the starting height will alway's be varying, due to the changing location of the fireing point, the values we don't know are velocity and time. Because the time is always changeing, and the x value has to be a variable for the equation to graph, we only need velocity, which is supplied by the creator.

Now, I know all the math part, but what I need help with is integrating it into the game. I know that:
-grenade ordinance classes have user adjusted values for
-gavity effect
-velocity
I also know that:
-ordinance classes (namely bolt and bullet) have user adjusted values (bleh, I feel an acryonym coming on, UAVs?) for:
-Velocity
-but not gravity

We all know that when you throw a grenade, it arcs in the classical parabola style. What I want to know is if it is possible to include this same style of physics into standard projectiles, either by including the same gravity lines in the projectile's ODF, or by classifying projectiles as grenades.

My second question is about scale:
the rate of acceleration of a body in a free fall on the planet earth (i.e., the rate of gravity) is 16 feet per second per second. (whatever meters per second per second for all you metric folk, sorry, I think it's 9.8 but I'm not sure)

We can tell that the grenades follow a fairly realistic trajectory, but in the ODF it does not, definently does not, say 16 as the gravity value. I'm pretty sure it says 1. So does that mean that 2 would give twice the strength of earth gravity? or is this some new measurement I'm not informed of?

Anyway, third question, (ok ok, this is the last one):
I haven't done any research into this, but would it be possible to include wind effect, to kind of push the bullet or such.

Anyway, these are mostly theoretical, so I'll just wait for someone like Psychofred to come along and tell me it's not possible, but it seems like it should be, so just disscuse you're thoughts.

This post brought to you by sophmore math, research in physics, and a severly underused imagination. Thank you for your time.

RE: A consideration on physics and projectile trajectories.

Posted: Tue Dec 12, 2006 2:33 am
by DaCheat
AHHHHH the thinking it hurts my BRAIN (or lack there of). Not sure how much I can help you with only being in the 9th grade and all.

RE: A consideration on physics and projectile trajectories.

Posted: Tue Dec 12, 2006 2:45 am
by Rikino
First off, I haven't really ventured into the land of .odf weapon physics (and the times I have have resulted in terminal-velocity nades), so this just my outside take on the matter, other people prolly know more than me (I only know what I know from first year calculus; no real physics classes for me yet).
The gravity variable seems to be more of a scale, measuring a constant downwards force, while the velocity is how far the ordenance travels a second (or whatever time unit).
To continue with the kinda-gratuitous math, it's the whole "rise over run" thing; velocity is, again, how far the ordenance travels a unit, and gravity is how far the ordenance goes up or down a unit (ooh- that's interesting. I bet you could make negative gravity; a shot that arcs up. Try putting in a value less than one (negative, maybe?)).

Second question: (first off, again, the default gravity is 1, which acts as no downwards force. Grenade's gravities are 1.25)
In the odfs and game, things are not really measured in real "feet" or "meters", (how far would those be in a compter?), so real-world constants like 16 ft a second have little meaning; the '1.25' is just a scale that they use, apparently it roughly mimics the downwards acceleration of a grenade.
I'll say it again: the 16 ft a second and whatever are left behind when you do this. Unless the scale built into the game was based on it, numbers are just numbers.

The part to skip to if you don't want to read too much:
I'll answer the first question second: As far as it relates to the game. I doubt changing the 'gravity' value in a bullet wouldn't work (double negatives are fun!), try putting a decimal in for velocity (one point something) to get the slight fall you're looking for.

Third question, sorry, that's out of my thinking-range.

It sounds like you're trying to make a realistic model of trajectories. It would probably take some experimentation to find what the "real world" translation in the game would be. One thing you didn't mention- the 'LifeSpan' thingy. If you want a bullet to keep moving until it hits something, you might want to increase this by a lot. Then again, artillery rifles are kinda weird, so you might want to have their speed decrease over time. This, you need someone who knows what's what to tell you what to change.

Sheesh. I started this like right after you posted and now there's two other comments before me. This took a while. Anyways, that's my two cents.

RE: A consideration on physics and projectile trajectories.

Posted: Tue Dec 12, 2006 2:59 am
by Bac-Talan
Good thinking Rikino, I'll try that.
(didn't realize it was 1.25, that makes it harder)

Also, ya, I would of course change the lifespan. Hopefully to some obsenely high value, as wouldn't a bullet fired in a vaccum, with no gravity or friction to stop it, go on endlessly?

And I would also probably be able to include something about it's damage going down the further it goes, so as to mimick the bullet losing velocity. (they do that right?)

Thanks for the responses guys.

(and DaCheat, the math isn't really that hard, it makes logical sense really, I just didn't explain well.)

Posted: Tue Dec 12, 2006 3:13 am
by Maveritchell
rikino wrote:...the default gravity is not 1, it's 1.25"
Not so fast my friend. Let me direct your attention to two .odf excerpts:
com_weap_inf_wrist_rocket_ord wrote:MinSpeed = "20.0"
Acceleration = "80.0"
Velocity = "80.0"
Gravity = "0.0"
Rebound = "0.0"
TurnRate = "0.0"
com_weap_inf_rifle_ord wrote:LifeSpan = "0.80"
Velocity = "300.0"
Gravity = "1.0"
Rebound = "0.0"
We see that the rocket has a gravity of "0," and the rifle has a gravity of "1." If 1 were equal to a force=gravity (ergo the straight path unaffected by gravity), and 1.25 was gravity > force, then any number <1 would be force > gravity, and a projectile with that line in the .odf would arc upwards. It looks like the only reason you don't see bullets arc down in BF is the same reason they appear to travel in a straight line in actuality - they move quite fast.

And as for anything being able to be affected by wind - I don't think BF supports that, and for good reason. Most of these projectiles have such small size/mass ratios, they wouldn't be affected by wind - like real ordnances. Gee, who'da thunk it. The closest you may get would be the waverrate function found in rocket _ord.odfs. For example:
com_weap_inf_rocket_launcher_ord wrote:WaverRate = "0.0"
WaverTurn = "0.0"
Play around with those, and I think you can achieve a similar effect that wind might have on projectiles - provided it's not a constant wind in one direction.

RE: A consideration on physics and projectile trajectories.

Posted: Tue Dec 12, 2006 3:28 am
by Rikino
Doh! I've been dunced!
I assumed (using the sniper ord .odf) that since it's gravity is 1, 'Gravity= 1' must be a straight line, right? Because you never see the sniper shot arc, right?
Wrong!
Like you said, it just moves really, really fast. Just goes to show, listen to me and you'll soon become support for natural selection.

Re: RE: A consideration on physics and projectile trajectori

Posted: Tue Dec 12, 2006 4:30 am
by Maveritchell
Rikino wrote:Doh! I've been dunced!
I assumed (using the sniper ord .odf) that since it's gravity is 1, 'Gravity= 1' must be a straight line, right? Because you never see the sniper shot arc, right?
Wrong!
Like you said, it just moves really, really fast. Just goes to show, listen to me and you'll soon become support for natural selection.
Well, maybe. It's not really a huge issue since the gravity effects they apply to SW lasers in BF don't make sense anyways. Assuming they're just coherent light, they're massless and should be unaffected by gravity anyway. It's somewhat ironic that only the ordnances with actual mass (i.e. rockets and other projectiles) have no effect due to gravity, and the lasers do, even if its a negligible effect.

@Bac-Talan: Really, unless you're going to be making some Spanish Armada map, complete with cannon broadsides, it's pretty pointless to worry about any sort of effect wind/gravity/outside force would have on weapons, since a majority wouldn't physically be able to be affected.

RE: Re: RE: A consideration on physics and projectile trajec

Posted: Tue Dec 12, 2006 4:36 am
by Penguin
Missiles and shells ((ATTE cannon, etc)) have gravity, try shooting something far away

Re: RE: Re: RE: A consideration on physics and projectile tr

Posted: Tue Dec 12, 2006 4:42 am
by Maveritchell
Penguin wrote:Missiles and shells ((ATTE cannon, etc)) have gravity, try shooting something far away
Most of the vehicle ordnances have gravity. What I was referring to (in terms of irony) was just the content of the two .odfs I pulled up, for the rocket and the blaster bolt.