Jump to content
  • Advertisement
Sign in to follow this  
WhiskyJoe

Connect points on a grid for cloth/mass spring system

This topic is 2097 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

Hey guys,

I'm trying to create a sort of cloth simulation through a mass spring system and well, it's not the mass spring system I got a problem with (I have a sphere and a rope that behaves correctly) but I am stuck on creating a grid!

I started off with thinking simple, just go through all the points and connect them, this however will never work as every point will be connected to every other.
What I want to achieve is to connect all the neighboring points to each other, but I can't seem to wrap my head around how to do this efficiently! I keep on bumping on the problem that I don't want the end of one row connect to the beginning of the next row, or vice versa and I don't want hardcode every exception (imagine doing that for a 100 x 100 grid).

Can someone give me some pointers on how to efficiently connect all neighboring points on a grid? Or if this isn't the way to simulate cloth through a mass spring system (in my head it is) point me in the right direction for that.

Share this post


Link to post
Share on other sites
Advertisement

I keep on bumping on the problem that I don't want the end of one row connect to the beginning of the next row, or vice versa and I don't want hardcode every exception (imagine doing that for a 100 x 100 grid).


Just don't connect the end of one row to the beginning of the next row. I don't think this is a hard problem: The solution looks like two nested loops.

Try some more. If you still can't solve it, post some code and maybe I can fix it.

Share this post


Link to post
Share on other sites

[quote name='Rld_' timestamp='1348087458' post='4981822']
I keep on bumping on the problem that I don't want the end of one row connect to the beginning of the next row, or vice versa and I don't want hardcode every exception (imagine doing that for a 100 x 100 grid).


Just don't connect the end of one row to the beginning of the next row. I don't think this is a hard problem: The solution looks like two nested loops.

Try some more. If you still can't solve it, post some code and maybe I can fix it.
[/quote]

Yeah.. It was getting late and I over-complicated things for myself :P

I had in mind that I had to connect every point I meet to every neighbor, but obviously I would end up with double connections which aren't needed and in that case I would need to make a lot of exceptions for every side, up, down and diagonal when getting to a corner :)

I figured it out, but thanks anyway :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!