Sign in to follow this  
PolyVox

Data structures for Physics?

Recommended Posts

PolyVox    712
Hi all, I'm about to dive into the world of physics simulation, and have read this excellent article at GamaSutra: http://www.gamasutra.com/resource_guide/20030121/jacobson_01.shtml (you need a free gamasutra account to view it). Now, I pretty much understand the whole thing, but I have some concerns about the way it will affect my data structures. It uses verlet integration and the algorithm basically: 1)Moves each vertex according to forces in the world (gravity, etc). 2)Enforces local constraints by ensuring that edges are the correct length, etc. 3)Go to (1) until system is stable. So previoulsly if I had a cube in my 3D world I would represent it with a list of vertices (the corners) and a list of faces. Now it seems I need to add: 1)A list of edges. 2)The length of each edge. 3)Some way of storing the angles between adjacent edges. (otherwise the cube could become deformed) All this seems a little complicated to represent a cube; am I missing something? The article doesn't actually mention the angles between the edges, and thinking about it it's possible that the angle aspect could be handled automatically when the edges are adjusted to thier correct length. Can someone confirm this? And do i really need to store the length of every edge in my mesh? Looking to the future, I'm going to be creating some kind of skeletal animation system. I would imagine this integrates quite tightly whith the physics. Maybe I should model my cube as having 8 'bones' for the edges? All thoughts appriceiated... David

Share this post


Link to post
Share on other sites
PolyVox    712
Havinf thought about it further, with the cube I could avoid the need for storing angles by having a bone going from one corner to the other. This would keep it rigid and stop it deforming.

Don't know if it's a good long term solution though, any further thoughts?

Share this post


Link to post
Share on other sites
jyk    2094
I've only done a little work with verlet - cloth simulation, simple shapes bouncing around - but as far as I can tell there's no need to store edge lengths or angles explicitly.

Share this post


Link to post
Share on other sites
oliii    2196
Quote:
Original post by esuvs
Havinf thought about it further, with the cube I could avoid the need for storing angles by having a bone going from one corner to the other. This would keep it rigid and stop it deforming.

Don't know if it's a good long term solution though, any further thoughts?


That is the way to rigidify the shapes with that particle system scheme. Add more supporting beams. But add more = more strain. have a super rigid cube, for example, you'd have to link every particle to every other particle. That gives n * (n-1) beams for n particles. Wallop!

This is why, in my opinion, the basic system is very limited for rigid body collisions, and it's best suited to things like clothes and ropes, why are quite loose.

What is more intriguing overwise, is the mix of rigid collision shapes surrounding a verlet particle system.

If you want to get angles throw in,

Using Verlet Integration and Constraints in a Six Degree of Freedom Rigid Body Physics Simulation (Rick Baltman)

That's a lot more to digest though.

Share this post


Link to post
Share on other sites
PolyVox    712
Quote:
Original post by jyk
I've only done a little work with verlet - cloth simulation, simple shapes bouncing around - but as far as I can tell there's no need to store edge lengths or angles explicitly.


Actually I think you're right about the angles (see my second comment above) but I'm sure you need the edge lengths. The way it worked in the paper I read was, once a collision has occured, you project the vertices out of the surface they colided with. This deforms the object, so you need the original lengths to restore it.

Quote:
Original post by Oliii
That is the way to rigidify the shapes with that particle system scheme. Add more supporting beams. But add more = more strain. have a super rigid cube, for example, you'd have to link every particle to every other particle. That gives n * (n-1) beams for n particles. Wallop!


I'm not sure about this. It's quite hard to visualise but I think one additional beam going between opposite corners should make it rigid. At most 3 additional beams (between pairs of opposite corners).

It seems from the comments posted that the approach I read about has a fair few limitations. However it seemed so brilliantly simple when I read it so i think i'll get it working and then try a more advanced approach.

Share this post


Link to post
Share on other sites
jyk    2094
Quote:
Actually I think you're right about the angles (see my second comment above) but I'm sure you need the edge lengths. The way it worked in the paper I read was, once a collision has occured, you project the vertices out of the surface they colided with. This deforms the object, so you need the original lengths to restore it.
Ah, I see - yes, the rest lengths are stored as part of the constraint structure. I guess I thought you were talking about something else. Sorry about that.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this