What about a *Physics* engine?
So my buddy and I got together and started building a tank game ... now, not just any tank game - a rather involved one with hovertanks. But how to make them _hover_ ? A simple sine function can take care of that... but it isn't very realistic... so ... long story short we started building a physics engine. Wow. Now here's the problem. Physics in 1d is simple. Physics in 2d... not much harder (just a little trig and you're on your way). However physics in 3d... now that is a pain in my backside. All we are trying to do is build an encapsulated "addforce" function... I tell you I have a force (say 1N along x, 2N along y, and 34N along z. With N=Newton) and then I tell you were to apply that force on the object (in relation to the center of mass). Somehow, I am going to get translational force and rotational force (known as torque) out of this... but how much of each of those? So I go back to my physics books... and WOW... they have 1d and 2d for kinematics (which is what this stuff is called)... but no 3d! Grumble. So, does anyone know this set of equations? Check out this page:
and please let me know the answer! I promise that when I get it, I'll post it on that page so everyone will have it. Thanks for your time!
Ghallo
Edited by - Ghallo on June 11, 2001 1:53:33 AM
look, i don''t know personally how to do rotational stuff and all of that, but here is what you do. you simply seperate each vector into it''s x and y and z components, do your torque stuff about the x axis, then y, then z. i think that should work. pardon me if this is a stupid answer. we never got into this in class. hope it helps some, though.
farmersckn
farmersckn
I wouldn''t trust this (you don''t want to see my grade in physics), but I''ll give it a try.
Given the center of mass, you know that any force, no matter where it is applied, acts on the center of mass. This allows you to treat this as a point mass--that''s the idea behind extended free body diagrams. I''m sure you know how to do this (even in 3D). Since these are hovercrafts, it'' essentially on a frictionless surface. So the only other forces acting on the object is gravitational and normal. So the net TRANSLATIONAL force is just F + W + N. Btw, these are vectors and adding them in 3D isn''t that much harder--esp. since the components are known.
The torque can be found, IMHO, using R x F, instead of Ia. R is simply the distance from the axis of rotation (which in this case is the center of mass) to the point where the force is applied. And you have F. The moment of inertia I doesn''t really apply here cuz you don''t know a, and finding it willbe more trouble than it is worth. "The Ultimate Kinematics Question" gave you I, so maybe they suggested going this route.
I think the way I found translational net force can be trusted, but I''d be wary about how I found torque. When in doubt, always draw a(n) (extended) free body diagram.
Btw, physics sucks. Never did like it, and most likely never will.
Jinushaun
Given the center of mass, you know that any force, no matter where it is applied, acts on the center of mass. This allows you to treat this as a point mass--that''s the idea behind extended free body diagrams. I''m sure you know how to do this (even in 3D). Since these are hovercrafts, it'' essentially on a frictionless surface. So the only other forces acting on the object is gravitational and normal. So the net TRANSLATIONAL force is just F + W + N. Btw, these are vectors and adding them in 3D isn''t that much harder--esp. since the components are known.
The torque can be found, IMHO, using R x F, instead of Ia. R is simply the distance from the axis of rotation (which in this case is the center of mass) to the point where the force is applied. And you have F. The moment of inertia I doesn''t really apply here cuz you don''t know a, and finding it willbe more trouble than it is worth. "The Ultimate Kinematics Question" gave you I, so maybe they suggested going this route.
I think the way I found translational net force can be trusted, but I''d be wary about how I found torque. When in doubt, always draw a(n) (extended) free body diagram.
Btw, physics sucks. Never did like it, and most likely never will.
Jinushaun
As you said, translational forces, acceleration and veclocities are quite straightforward (just sum up).
If you only have a single axis of rotation, then rotation is simple, just an extended 2D version.
If your object is totally free, then it's going to be complicated: To do it right, you first need an intermediate representation of the rotation and the inertia of rotation, the torque, this can be a matrix (not so good, might drift away), or a quaternion (better). Now, the problem is that your objects are not perfect spheres, so the exact point of application of the force relative to the center of mass is important. You'll end up needing a measure on how difficult it is to rotate the object around a certain axis, in his current state of motion and on a certain point of application. This is called the inertia tensor. Hope you're very good at math now This tensor needs to be integrated over the volume of every single object, and it changes with rotation.
For a better explanation, along with examples and all formulas look at:
http://www.d6.com/users/checker/dynamics.htm
Hope it helps, and physics are very fun (I think) !!
A.H aka Blueshift
Edited by - blueshift on June 11, 2001 2:26:51 PM
If you only have a single axis of rotation, then rotation is simple, just an extended 2D version.
If your object is totally free, then it's going to be complicated: To do it right, you first need an intermediate representation of the rotation and the inertia of rotation, the torque, this can be a matrix (not so good, might drift away), or a quaternion (better). Now, the problem is that your objects are not perfect spheres, so the exact point of application of the force relative to the center of mass is important. You'll end up needing a measure on how difficult it is to rotate the object around a certain axis, in his current state of motion and on a certain point of application. This is called the inertia tensor. Hope you're very good at math now This tensor needs to be integrated over the volume of every single object, and it changes with rotation.
For a better explanation, along with examples and all formulas look at:
http://www.d6.com/users/checker/dynamics.htm
Hope it helps, and physics are very fun (I think) !!
A.H aka Blueshift
Edited by - blueshift on June 11, 2001 2:26:51 PM
Hello
Well this is not exactly the answer to your question but as you I begin to build some physics engine for my simulation of one ball rolling over a terrain in 3D, so I begin to search info about physics in 3D and I have found some very very good docs about it with complete source code, so here is the urls:
http://www.gamasutra.com/features/20000516/lander_01.htm
http://www.gamasutra.com/features/20000510/lander_01.htm
http://www.gamasutra.com/features/20000215/lander_01.htm
http://www.gamasutra.com/features/20000208/lander_01.htm
Also check: http://www.d6.com/users/checker
get the 4 articles, and see the references there, there is a lot of info about physics!!
Hope it help you as it help me!
Regards!
Well this is not exactly the answer to your question but as you I begin to build some physics engine for my simulation of one ball rolling over a terrain in 3D, so I begin to search info about physics in 3D and I have found some very very good docs about it with complete source code, so here is the urls:
http://www.gamasutra.com/features/20000516/lander_01.htm
http://www.gamasutra.com/features/20000510/lander_01.htm
http://www.gamasutra.com/features/20000215/lander_01.htm
http://www.gamasutra.com/features/20000208/lander_01.htm
Also check: http://www.d6.com/users/checker
get the 4 articles, and see the references there, there is a lot of info about physics!!
Hope it help you as it help me!
Regards!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement