Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

JSoftware

Rigid Body Basics

This topic is 5270 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m new to physics and i need a couple of answers before i want to go on adding simple physics into my game engine. rigid body dynamics: isn''t this only for cars and such? how does this work? (if i''ve understanden it right then it shots rays?) do i need this? rag dolls: haven''t found out a propper way of doing this. a nice outline of the function would be very much appreciated other very important physcis something i need? regards jeppe

Share this post


Link to post
Share on other sites
Advertisement
Unfortunalely there's really no such thing as 'simple' physics, especially not if you are including collision in that statement. Ragdoll in particular is extremely difficult to implement with real time performance. Check out my sparse matricies thread to see the kind of things you'll be up against. However it is not my intention to discourage you. Although difficult, the rewards are definately worth it. Since you are new to the subject I recommend studying 'Game Physics' by D.H. Eberly. Quite possibly the best game physics book out there.

[edited by - motorherp on June 7, 2004 1:23:55 PM]

Share this post


Link to post
Share on other sites
Rigid body dynamics isn''t just for cars. It is used for, basically, any object motion where the object does not deform---shape stays the same and its tranformation matrix (rotation + translation) is the only thing that changes. So, cars + airplanes (usually) + crates being kicked around + most anything.

Rigid body dynamics also is used to implement rag doll physics. The extension is that for rag dolls, there are multiple rigid bodies (the limbs of the skeleton) linked together by joints, such as hinge joints, ball joints, etc. A solid rigid body physics implementation will support various joints, and this is a necessity for rag doll effects.

As for what you need in your game engine...depends on you goal. I would say that "simple" implies: a) NO rag doll (which is not simple); possibly b) ONLY sphere-sphere or AABB (axis-aligned bounding box) collision detection, since collision detection becomes less and less simple as you do OBB (oriented bounding box) and generalized polytope collision detection; c) NO articulated rigid bodies (bodies linked by joints); and, maybe even d) NO rotating objects (since transion + rotation is a tad more complex than just translational physics).

There is a question in the Forum FAQ that makes further suggestions. I would recommend you read it, given that you seem to be starting at ground level.

Graham Rhodes
Principal Scientist
Applied Research Associates, Inc.

Share this post


Link to post
Share on other sites
I''ve written a very nice collision library which handles tri to sphere collision. tri to box. box to box. sphere to sphere.
both aabb and obb boxes

but it does only serve for collision no organisation!
i don''t know how i shall handle all the information about the bodies in the map or something. i''m currently trying to make a object containg all objects containg information about its mass(and such) and a simplified mesh. and then run a loop on each object and check for movement.
if it moves then
check if it intersects some other object in this move
if it does then
check if the recieving object is static or dynamic
if dynamic then
do something smart.. :S
if static then
make the sender jump or something smart..

is this the way?

Share this post


Link to post
Share on other sites
You''ve got the basics down and you''re definately thinking along the right lines. I''d recommend mapping your dynamic objects to a multi resolution grid or determining collision islands using dimensional reduction in order to speed the collision detection phase. For dynamic to static collision I would construct an octree around your static mesh, espicially if it is large, and collide the dynamic objects with the octree to localise the collisions. Many articles on the above techniques can be found all over the internet or you might want to try the ''Game Programming Gems'' books (I think 1 and 2 cover the above topics quite well). Once a collision is detected there are many way s you can go. The simplest is probably to find the intersection points and penetration depth of the colliding object and create a spring between these points whose strength is determined by the penetration depth. This is known as the penalty method, but unfortunately it does have its problems (not accurate, equations can become stiff). The other route is to determine the exact collision time and point and apply an impulse to both objects to prevent them from penetrating. This method works very well with rigid body dynamics. unfortunately this is a very large and complex topic so I really do recommend you read a good book on the subject.

Share this post


Link to post
Share on other sites
Just keep in mind that physics don''t have to be 100% accurate for a game. You''re not trying to simulate reality, you''re trying to make something enjoyable. For most people, enjoyable means "runs at a playable speed".

Share this post


Link to post
Share on other sites
Very true Etnu. If full on realism isn''t your goal you might want to do a bit of research into Verlet physics. Very easy, stable, and computationaly efficient. Doesn''t look too bad either.
Just remember, you can learn more from one good book than you could ever possibly hope to discover for yourself in a lifetime.

Share this post


Link to post
Share on other sites
Okay, first things first - unless you''re making a physics-oriented game (vehicular or lots of boxes and blocks) you don''t need rigid-body physics.

For example, in most FPS games, all characters are modeled as a cylinder. They do not model any concept of moment of inertia (you can rotate as fast as you want and nothing else can make you rotate). Nothing bounces - if you run into something, you just push up against it. Very simple.

Newer FPS games include rigid-body for stuff like crates, boxes, and grenades and suchlike - its used for throwing solid, rigid objects around. You need it for any kind of realistic collisions with that sort of thing - humans aren''t well modeled by this, as we aren''t big bricks.

Ragdoll is done by chaining a bunch of rigid bodies together into a humanoid shape and then attaching a player model to them, basically.

But most games either ditch the physics altogether, or use some strangely simplified version of newtonian physics as applied to individual particles, rather than actually modelling objects as shapes.

Keeping everything as spheres, parallel cubes/rectangles, or upright cylinders is generally the best approach. It removes the need for all that rigid body stuff.

Share this post


Link to post
Share on other sites
rigid body physics is good if you want realistic-looking crates falling on the floor, things swinging on ropes, cars driving and colliding against other cars and the track, solid bodies smashing into each other with part falling off....

rigid body dynamics does not ''shot rays'' it''s using newtonian physics on objects, like mass, inertia tensor, linear and angular momentums, ect... to make a solid body tumble and impact. There are many other complicated things, like joints, constraints, friction, even deformations and breakage. for basic rigid-body physics, look for chris hecker''s beginners articles. they shoudl give you a great start.

Ragdolls are usually a hierarchy of rigid bodies joined together with physics joints, they impact, they bend only that far, ect...

Things like ropes, clothes, squashy blobs, and even ragdolls, can be approximated with simpler particle systems. Look for Thomas Jakobsen''s papers on that subject. He even hint on how to design a system similar to a rigid body system while still using a particle-based approach. I''ve yet to see anything convincing on that subject, and I''m still trying to find some time to do a bit of research on it. That particle system stuff is very accessible.

Rigid bodies are very maths-phsyics intensive. They rely on proper mechanical principles, used in fields like mechanical engineering, so they can be very technical. But the basics should be like a solid A-Level newtonian physics and maths exercise.

if you feel lucky, look for David Baraff''s GDC papers on advanced rigid body physics, you''ll get a taste of what it''s like.

Share this post


Link to post
Share on other sites
What kind of game/engine are you trying to write? What type of physics you should include pretty much depends on that - an FPS like Quake would have a completely different physics engine than, say, a pool game.

Physics can get really hard really fast, so you should think carefully about what you absolutely need and build up your physics engine based on that.

Unless you''re interested in physics for the sake of physics, in which case you can dive all the way in :-)

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!