This site requires JavaScript, please enable it in your browser!
Greenfoot back

Comments for Softbody Physics

Return to Softbody Physics

flygirl540flygirl540

2009/3/20

is that a box or a triangular prism?
qnanqingqnanqing

2009/3/21

no matter what is that.. that's great :D
mjrb4mjrb4

2009/3/21

Brilliant!
NintoNinto

2009/3/21

Very nice! \:
NintoNinto

2009/3/21

Very very nice!! \: /:
NintoNinto

2009/3/21

If you set the acceleration to 1 instead of 0.2 then will the box-thing be completely flat when it hit the wall! \:
Thanks!, When you set the acceleration that high, the force is great enough to press the box completely against the wall, and then all the forces are directed horizontal, so the box can't spring back easily.
mbreadmbread

2009/6/21

Cool! Just goes to show some of the advanced things you can do with Greenfoot. Seeing some games making use of this would be great too.
DonaldDuckDonaldDuck

2010/10/27

Another nice demo Builderboy. Say, I was considering making a "Jelly Car" like scenario. Would you mind if I use this as a starting point?
Builderboy2005Builderboy2005

2010/10/27

Sure use all the code you need :D
DonaldDuckDonaldDuck

2010/10/28

Thanks =D I was going over your code and I was just wondering (I'm no expert with doubles) if, instead of drawing the lines for the image, you could draw the lines onto the actor and move the actor itself... Just to clarify, instead of having double x as the X location on the image, I'm trying to make it so that it does something like setLocation(x, y) so that I can find if another actor intersects... I'm not great at explaining stuff like this, I'm only 13, so, it's not a wonder. Thanks again Builderboy.
SPowerSPower

2012/7/15

Could you also add gravity? That would make it even better!
Gravity would be trivial to add ^^\
DutaDuta

2013/1/1

In the spring class, it would make the code more readable to change the places where you do "Math.sqrt(Math.pow(someValue, 2) + Math.pow(someOtherValue, 2))" to "Math.hypot(someValue, someOtherValue)"
UpupzealotUpupzealot

2013/6/22

Hi, BuilderBoy. This scenarios is awesome. I'm looking into soft body these days. May I ask, how did it expands to other shape. I looked into your code and find out it was based on the "mass point - spring net" model. If it is a shape with N sides, the number of springs would come to N(N - 1) / 2 (if you put a spring between every two mass points), when N is lager than about 30, things became slow. I search on the internet and find there is an other model called PSB(pressure soft body), it's similar with this one, but the amount of calculation is much less(I think it's about 2N). I tried PSB in greenfoot, but the the effect is not ideal. I thought I'd better share the infomation with you(or anybody who was interested in soft body simulation), hope we can have a better model one day.
DutaDuta

2013/6/22

Upupzealot, if you're interested I did a rewrite of this scenario: http://www.greenfoot.org/scenarios/7158
UpupzealotUpupzealot

2013/6/23

@Duta thanks for replying. I looked into your code. You were using the same model with this one.For the JellyPentagon class, you build 10 springs in a soft body. As I said, it would need N(N - 1) / 2 springs for a shape has N sides. When N comes lager, the scenario comes slow. I was looking for another model which is better. It's called "Pressure Soft Body" which suppose there were some ideal "gas" in the soft body to support it.