Archived

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

oliii

mixture of verlet and rigid body physics demo

Recommended Posts

oliii    2196
right, I can''t take credits for the idea, it came from a friend who was messing with it, but I''ve implemented it for fun, and wayhay! pretty sweet. another verlet physics demo basically, here is the general concept. It''s a mixture of rigid body physics and verlet particles (yes, another one). But wait, it''s actually a lot lot faster and simpler than the concept of generating hundreds of constraints withing a body. right, first of all, each body has an tetrahedron structure inside, which is basically a verlet particle system (4 particles, 6 constraints). That tetrahedron is used for two things. defining the general orientation and position of the body, and also generating the actual body movement (rotation and translation). Imagine you make the tetrahedron particles as collidable, then the tetrahedron will bounce all other the place happily, like any verlet paricle system. now, the trick is to use the tetrahedron only has a frame to support the rigid body, and use the rigid body''s collision mesh to influence the frame, so the frame rotates and moves upon impact. this is achieved very simply. When a collision between the mesh and the world is detected, you generate a temporary set of constraints from that colliding point, linking the point to the frame (so it''s 4 constraints). What these constraints will do, is push the frame out of the way, effectively rotating and translating the frame. the nice thing is, you can use any types of collision mesh, and you solve constraints only on the tetrahedron (6 per body), and on the temporary collision points (4 extra constraints per point). so in the end, the number of constraints to solve is minimal. In the example, I used a 800 vertices mesh (a bunch of dolphins), and another pretty complex mesh, bouncing on the terrain. The green lines represent the collision constraints, and you can see that there is only a handful of them at a given time. The red thing is the tetrahedron frame, supporting the rigid body. if you can''t download it head straight to my homepage the trickiest part is in the collision detection, which incidently can be done on a per-triangle basis. My next try will be to use something like Rapid (OBB and tri mesh), and try collisions with that. Since I don''t need that much informations (like the normal of collision), and only solve intersection between triangle, that would be quite interesting. the next step, joints. It''s got simple verlet constraints, plus some useful informations, like the actual orientations of the bodies, so very useful for angular constraints.

Share this post


Link to post
Share on other sites
sBibi    241
very nice technique
but there is a little problem with your demo... almost nothing really, it's only a detail, and not a bug of your collision algorithm... I played with it for around 10 minutes hitting 'r' and watching those dolphins and that gun spinning around with the green constraints flashing as the meshes hit the ground, until the dolphins went off the terrain... I guess because of the verlet integration, they violently went back in, then hit the other side, and started flying up and away very rapidly, until the app was terminated because of a floating point error...

but apart from this little detail, very clever algo

[edited by - sBibi on March 28, 2004 8:17:03 PM]

Share this post


Link to post
Share on other sites
oliii    2196
quote:
Original post by Bouncer
This idea is already mentioned in the original Thomass Jakobsens paper.



right, yeah. I re-read the paper, past the point I was mostly interested in before. Anyhow, that''s an implementation of it. And I think it''s worth a demo and further investigations.

about the terrain bug, I''m aware of that. I don''t think I''m doing bound checks on the terrain coordinates.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Sweet! You''re making me want to play around with verlet again, perhaps I''ll get further than just having a bunch of tetrahedrons bouncing around this time

Share this post


Link to post
Share on other sites
oliii    2196
lycos lycos lycos..... Gotta change my provider. any recommends a stable web hosting? no BS, good space (preferably 50 mb, like lycos), and obviously free? Just need something where people can download from with no freaking hassle!

Share this post


Link to post
Share on other sites
jack_1313    536
Have you considered Legion (Gibbering.net)? If I remember correctly they offer free packages to game developers. I personally can recomend the service as my current project is hosted by it. 50mb, no restrictions.
Edit: The banner ad is by the URL masking service.

[edited by - jack_1313 on March 30, 2004 3:48:15 AM]

Share this post


Link to post
Share on other sites
oliii    2196
thanks for the offers guys. There are loads of sites with free hosting (I''m a tight bastard ), I''ve got one at 125mb.com. 125 megabytes for free, but I''m expecting loads of pr0n emails and spam. Oh well, that''s what hotmail''s for. I''ll probably ditch 125mb.com and go for the Legion one, keep it in the community.

anyway, back on topic, I''ll probably work on it over the weekend. I''m not sure what though. Ragdolls? At least a joint would be a start

Share this post


Link to post
Share on other sites
Bouncer    145
Got it downloaded with DAP...looks nice.

Only problem with this method is that if you use... say tetrahedron and embed it inside the object (or embed the object inside tetrahedron - as in this example). The kinetic properties of the object in question will resemble that of an tetrahedron. Therefore certain shaped objects don''t act properly. Best way as I see it would be to use some kind of rough estimate of the objects shape as the physics model and then do this method to find the accurate collisions. I think that would work great and be fast.

Oliii: Great implementation though.

Share this post


Link to post
Share on other sites
oliii    2196
you''re right. you can also reshape the tetrahedron to model the inertia tensor more accuractely.

I used a perfect tetrahedron, which looks massive, but you don''t have to. I''m not sure how to derive the tetrahedron size, aspect ratio, and original orientation given the model, but I''m sure it can be done.

but you don''t have to limit yourself to a tretrahedron, as you said. however, as you had to the frame, the number constraints grows exponentialy (of some kind).

Share this post


Link to post
Share on other sites