3d math tutorials up

This is a discussion on 3d math tutorials up within the Game Programming forums, part of the General Programming Boards category; I don't entirely understand what you mean, but if you are talking about having it move in a sine wave ...

  1. #16
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    I don't entirely understand what you mean, but if you are talking about having it move in a sine wave and actually calculate its speed per second then I think it's a waste of calculations. The doom3 engine actually does something like this though, not the sine wave part, but the bullet is treated as a real particle and can reflect off of hard surfaces...when bullets go through smoke, the smoke actually spirals, pretty neat eh?

  2. #17
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    Originally posted by Thantos
    Here is a challange for ya since I've seen very few games that do it well.

    Accurately move a bullet in a normal flight path. And of course optionally include the bullet spread.
    Mathematically, that's not horribly difficult (anyone with a bit of physics should be able to describe the motion using parabolics). However, computationally, it's a lot more intensive than straight line bullets, and would likely just confuse the player. Anyway, perhaps it would be possible (read: feasible) to approximate realistic motion through the use of lookup tables or something. But, as you probably know since you were in the army, there are a number of ways of sighting in a weapon. You can sight it so that it will hit consistently at a certain distance - at shorter distances it will be high and longer distances, low. You could also have the sights completely parallel to the barrel (not for real world use), so that the bullet begins dropping as soon as it leaves the barrel (no initial vertical velocity). Anyway, look at the difference in computations:
    Code:
    "simple"
    y=(initial vertical velocity)*t + initial_height
    
    "realistic"
    y=initial_vertical_velocity*t + (1/2)(-gravity)t^2 + initial_height
    The difference between "simple" and "realistic" is the term (1/2)(-gravity)t^2, which can be simplified to (k)t^2 where t represents (1/2)(-gravity) (constant, can be precalculated and #defined unless you deal with variable gravity) However, that's still three multiplications PER bullet, PER frame. That can get expensive, and the player probably either wouldn't notice or would think the aiming system was off. Especially since most FPS rely on fairly short distance shots, meaning there would be a short flight duration and hence only a slight bullet drop. Conclusion: not hard to do, but why?

    think of something that hasn't been done. I was thinking about realistic speed in a game, because that was one of the problems I've had trouble with, and with instantaneous velocity we could get into some calculus with derivatives, that'd be kind of neat.
    We could do that. I'm not 100% positive what you mean (it would require clarification) but it sounds workable. We could also throw in momentum, and perhaps rotational momentum (hmmm... does anyone have a use for rotational momentum in a game?)

    Oh, and for emphasis since we haven't gotten an answer...
    has anybody actually read it yet?
    Away.

  3. #18
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Actually what I mean is that a bullet does not travel straight. Looking at the side it makes an arc. Example: The M16A2 with its sights adjusted to 300, when it fires a bullet the bullet will cross the same horizontal plane at 33 and 300 (I can't remember if it was meters or yards since they were always interchanged).

    The arc is based off many factors including: rifling, amount of gun power, muzzle velocity, air temperature, and to a smaller degree wind (it effects horizontal movement more then arc).

    It always annoys me in a game when you can shoot a pistol just as accurately as a rifle over 100 yards.

  4. #19
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    for the second time it is because bullets travel in waves

    EDIT: everything travels in waves just it is only noticable when there is a lot of energy for a given amount of mass

  5. #20
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    Originally posted by Silvercord
    I don't entirely understand what you mean, but if you are talking about having it move in a sine wave and actually calculate its speed per second then I think it's a waste of calculations. The doom3 engine actually does something like this though, not the sine wave part, but the bullet is treated as a real particle and can reflect off of hard surfaces...when bullets go through smoke, the smoke actually spirals, pretty neat eh?
    Bullets don't move in a sine wave. Sine waves are periodic. They move in a parabola See above. However, calculating the speed every frame due to speed reduction due to air resistance would be an even bigger waste of calculation than what I just said That formula isn't easy. (Well, it's easy, but not on the processor). The thing with the smoke though... that's cool. Although I'm not sure if it really does it much in real life... I may have to try
    Away.

  6. #21
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    that's not ture, it's a sine wave

    EDIT: the origin of the wave bends because of gravity, but it is still ultimately a sine wave

    EDIT1: everything moves in waves
    Last edited by Silvercord; 09-02-2003 at 05:41 PM.

  7. #22
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    The arc is based off many factors including: rifling, amount of gun power, muzzle velocity, air temperature, and to a smaller degree wind (it effects horizontal movement more then arc).
    This is what we call wasting more clock cycles than your computer has. The cause for the arc, as I said, is the sighting. When you're looking through your scope at something 300 yards away, the barrel is actually pointed up a bit. Not horizontally. vertical velocity becomes 0 due to the effects of gravity half-way to the target (when the gun is sighted to the target distance). Oh, and you forgot bullet weight. Momentum plays a large part when overcoming air resistance.
    Away.

  8. #23
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    Originally posted by Silvercord
    that's not ture, it's a sine wave

    EDIT: the origin of the wave bends because of gravity, but it is still ultimately a sine wave
    WHAT THE HECK ARE YOU TALKING ABOUT?!?!?

    You shoot a bullet in real life. It flies a long distance, and drops to the ground. It does not go back up after that (discounting richochet). A sine wave goes back up. Plus, it's simple newtonian physics. You know this Silvercord.
    d=v_i*t + (1/2)a*t^2
    apply that to vertical velocity/acceleration (gravity) and distance above the ground (or relative to the muzzle)
    Away.

  9. #24
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    and you wouldn't ever actually use parabolics in a game...ever...the only useful thing is the instantaneous velocity of all forces on an object...the derivative of the parabolic equations


    i.e for gravity i use 32x as the speed

    but if i wanted to graph the height you use -16x^2 + initialvelocityx + initialheight;

    EDIT: i know im right about the sine waves, im not giving up so easily, im drawing a picture, I didn't ever say the wave is huge, but it is definitely there

  10. #25
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    were in the army
    BLASHMEY!!!

    Take a look at my avatar again.

    As I said the speed reduction due to wind speed is minor. When firing at 500 meters if we had a head or tail wind there would be no sight adjustments.

    Edit: Yea your right I forgot about bullet weight.

    And I know that the barrel is pointed upwards. Most things are a constant ( or close enought to be used as such)
    Last edited by Thantos; 09-02-2003 at 05:47 PM.

  11. #26
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    Originally posted by Silvercord
    and you wouldn't ever actually use parabolics in a game...ever...the only useful thing is the instantaneous velocity of all forces on an object...the derivative of the parabolic equations


    i.e for gravity i use 32x as the speed

    but if i wanted to graph the height you use -16x^2 + initialvelocityx + initialheight;

    EDIT: i know im right about the sine waves, im not giving up so easily, im drawing a picture, I didn't ever say the wave is huge, but it is definitely there
    Yeah, if your X axis is vertical......

    The motion could be modelled by a sine wave, but it is in NO WAY accurate. And the trig calculation is more expensive than squaring a number anyway. If you were going to do this in a game, parabolics is the way you would do it. Seperate the X and Y (and Z) values, and have them vary according to T. That's the only (good) way to do it, and it's a lot cheaper than doing anything else.
    Away.

  12. #27
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    Originally posted by Thantos
    BLASHMEY!!!

    Take a look at my avatar again.

    As I said the speed reduction due to wind speed is minor. When firing at 500 meters if we had a head or tail wind there would be no sight adjustments.

    Edit: Yea your right I forgot about bullet weight.

    And I know that the barrel is pointed upwards. Most things are a constant ( or close enought to be used as such)
    Wind speed may be minor, but air resistance is not. Try firing your pistol on the moon and you'll see what I mean.
    Away.

  13. #28
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    On the moon you'd also have to factor in the reduction in gravity which would probabily have more effect then the air resistance.

  14. #29
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    Ok, I guess I have to explain the air resistance to you. Air resistance slows down an object as it travels through the air. It can be looked at as many collisions with air molecules, each of which take some of the object's momentum. This accumulates. Without air resistance, horizontal velocity is completely constant for a bullet. With air restance, the bullet will slow down and stop short of where it was expected to be when calculations were performed without accounting for air resistance. In a game, it would be pretty safe to just make the estimation that the decrease in speed is linear, although in actuality it is not. But here's a true story for you: In an evacuated tube (read: no air), a penny and a feather fall at EXACTLY the same rate. This is because there is no air resistance slowing either one down. I've seen it myself.
    Away.

  15. #30
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    I know how air resistance works. It is also consistant enough to assign a value for it.

Page 2 of 3 FirstFirst 123 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 3d math questions
    By linuxdude in forum Game Programming
    Replies: 3
    Last Post: 01-04-2005, 10:07 PM
  2. Min Math level req for 3d graphics?
    By EvBladeRunnervE in forum Game Programming
    Replies: 12
    Last Post: 02-24-2003, 10:32 PM
  3. 3D Math translations
    By Crossbow in forum Game Programming
    Replies: 2
    Last Post: 07-18-2002, 10:39 PM
  4. Please point to some really simple 3D tutorials
    By Tazar in forum Game Programming
    Replies: 6
    Last Post: 02-08-2002, 12:34 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21