#### Archived

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

# mixture of verlet and rigid body physics demo

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

## Recommended Posts

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 on other sites
keys are a, w, s, d capslock, tab for camera movement, and ''r'' to restart.

##### Share on other sites
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 on other sites
This idea is already mentioned in the original Thomass Jakobsens paper.

[edited by - bouncer on March 28, 2004 10:27:21 PM]

##### Share on other sites
oliii your demos are awesome. Cheers for making the source code available

##### Share on other sites
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 on other sites
Good work... I only just discovered you homepage and all the demos posted there.

##### Share on other sites
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 on other sites
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!

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 9
• 9
• 11
• 11
• 23
• ### Forum Statistics

• Total Topics
633679
• Total Posts
3013294
×