r00t 3:16 wrote:
But suppose you wanted it so players who shoot weapons had to
compensate for distance, aiming a little ahead of a running player
etc.
Is the source engine able to do this?
I think it probably depends on how fast you want the bullets to move
through the air.
If you make bullets a true entity (with gravity and collisions, etc),
then you have to update their location as they move through the world
(applying gravity, checking for collisions, etc.).
Calculating the height change due to gravity over a given period of time
is pretty straight forward high school physics (use google.com if you
want the math).
The real issue is that things that move VERY fast through the world
don't get their position updated often enough to follow the path of a
true parabola. You get something like this (excuse the ASCII graphics)...
Game Ticks (StartFrame) at the 'v's
v v v v
x----------x
/ \
/ \
/ \
/ \
/ \
/ \
/ \
x x
The 'x' object follows the path of a parabola but because you are not
ticking the engine at 1000's of times per second, you wind up with
discrete locations along the curve (at the points in time where you can
calculate where the entity will be at that time). If you are only
checking for collisions at these points in time (or doing line/hull
checks from the previous point in time to the current point in time),
you will miss hitting entities that don't lie along your discrete path
(like at the top of the arch in this case).
You can modify the calculations so that you do your own "stepping"
between discrete points in time to create a true parabolic curve and do
your own collision checking to see if an entity was collided with, but
this can be somewhat time/CPU consuming.
There's a pretty good O'Reilly book called "Physics for Game Developers"...
http://www.oreilly.com/catalog/physicsgame/
...if you are really serious about creating realistic physics in games,
you should definitely get that book (I hope your math skills are REALLY
strong). :)
--
Jeffrey "botman" Broome
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders