Aces High Bulletin Board
General Forums => The O' Club => Topic started by: StSanta on March 06, 2002, 06:36:42 AM
-
Alright, been playing around with graphics programming - started off in Java and is now working with C++.
What I've done, quite basically, is I've taken age old books on graphics programming and used the math in there to create a quite basic 3d world.
First time I do it, so the code is probably toejame slow. And yeah, I should use d3d/OpenGL, but I wanna try out the basics, and see if I can understand and implement the math.
At any rate, in my wonderful little 3d world, I have some very cute polyhedrons. Use back face culling, and have implemented Painter's algorithm - still working on making Z-buffering run acceptably, although the worst case run time seems a bit worse.
So, I have some objects, and I have this cute little box I can fly around with. Now, how the hell do you introduce physics into this world? The whole aspect of doing this isn't immediately obvious to me, and I've been unable to find good books on the subject.
So any references on books on this (bet HTC know how :D) would be greatly appreciated.
Am doing this as part of my studies - gonna have an exam in this stuff. Well, the exam is in graphics programming and there's lots more of that to implement, but I want to have some basics down. I want the box to accelerate according to a curve, and I want there to be g-forces, so the box can jump off cliffs and stuff. I.e very elementary physics stuff, nothing fancy.
Hope some of you can direct me towards a good source of info.
-
StSanta....
Not sure if this site will help you or not, but it contains a lot of interesting material relating to physics engines.
Click HERE (http://www.grc.nasa.gov/WWW/K-12/freesoftware_page.htm) for FREE NASA Software, that permits anyone to simulate all kinds of different physics motion, including airflow around various shapes of airfoils, baseballs, engines etc. I'm not sure if they come with source code examples, but it's a good place to start looking around for this type of stuff. I notice that there's a number of teacher/student dialog areas with problem solving sections.
Regards,
Badger
-
Originally posted by StSanta
So, I have some objects, and I have this cute little box I can fly around with. Now, how the hell do you introduce physics into this world? The whole aspect of doing this isn't immediately obvious to me, and I've been unable to find good books on the subject.
Well, in my piece of work I actually had a physics engine done before the 3d visuals (it was the physics I was more interested in, anyway). My physics engine was done with vector mechanics (dunno what it shold be called).
Soo... on the very basic level it was just plain and simple forces acting on my objects. Done with vectors they had a starting point, the vector itself and the magnitude of the force stored. From those I could get the linear acceleration of the object and could also calculate rotational accelerations. IIRC I made it so that the objects would always rotate around the origin of the 3d-model. So I assumed that the object would always rotate around the CG and was content setting the origin of the 3d-model at it's CG.
From accelerations I would just interpolate velocity from v = at (ie. assuming a is constant for duration of t) and from that location. If the physics loop is run at high enough a frequency, then t is small and the results are at least somewhat accurate.
While writing physics for my prog I didn't have any books and did it just relying on basic high school math and intuition. The 3d part was much more tricky.
If you want, I can email you my code. It's an old work-in-progress I later abandoned and it's not pretty and not altogether functioning as it should and probably buggy too, but perhaps it might help. It's written in C++ too.
-
Herr Grössenarsch,
try these:
http://www.amazon.com/exec/obidos/ASIN/1584500379/ref=pd_sim_books/002-1925243-4335268
http://www.gamedev.net/reference/list.asp?categoryid=28
http://www.gamedeveloper.net/html/programming/physics.html
F.
-
Try searching http://www.gamasutra.com for articles by Chris Hecker.
He had a really great 3 part series a while back.
I'd also recomend:
"Physics for Game Developers"
ISBN: 0-596-00006-5
O'Reilly Press
Its a great introductory text.
Regards,
Wab
-
Gee, those links would sure have come in handy, too bad I didn't come ask for advice here when coding my stuff :D
I might dare to argue though that when you figure it all out by yourself from the bottom up you might comprehend the particulars of the issue at hand better. Then again, one could say that reinventing the wheel is of no use whatsoever. YMMV.
-
>I might dare to argue though that when you figure it all out by
>yourself from the bottom up you might comprehend the
>particulars of the issue at hand better.
(shrug) Maybe, maybe not.
In school, when I took Calculus, I wasn't forced to invent it on my own before be allowed to open the text and learn from it. Maybe I would have learned it more deeply, or maybe it would have just taken me longer.
Your mileage may vary,
Wab
-
Thanks for the links! And sure, send me yer code: would love to have a look at it.
Have just been trying to add particles to the 'graphics engine' (too pathetic to be called that). Yuck. YARK. Hell of a lot of math in graphics programming.
Seems the physics will be even worse.
Heh.
-
Originally posted by StSanta
Hell of a lot of math in graphics programming.
Seems the physics will be even worse.
Heh.
Yep.
so true :)
-
Originally posted by StSanta
And sure, send me yer code: would love to have a look at it.
I would, if I only could get your e-mail address from somewhere.
"Sorry! That user has specified that they do not wish to receive emails through this board etc yadda yadda"
-
Odd: my profile says I have it on.
Anyway: stclaus@stofanet.dk
Appreciate it SageFIN :)