-
2 Attachment(s)
Spring-chain: A walrus example :)
Hi,
Some of you might remember me from almost a year ago (at least, I hope so :). I used to post examples here on how to accomplish special effects like curly tentacles and rippling water. I'm making an effort to move on to more professional methods of game creation, because I'd like to do it for a living. However, MMF will always remain a hobby (as well as a useful tool for rapid prototyping and such).
Anyway, I've been spending a lot of time lately visiting my brother in the hospital, and since his laptop has MMF, I made this example of how to accomplish a bungee-cord-like effect. It's fully commented, so hopefully people can learn from it.
---UltimateWalrus :3=
-
Re: Spring-chain: A walrus example :)
I Love you! This is a truely awesome example. It reminds me of one for MMF 1.5 where there were 3 blue balls connected in a spring like this, did you make that one aswell?
It's good to see some physics work done in MMF2. Now it's time to make a spiderman game ;P Thanks a lot!
-
Re: Spring-chain: A walrus example :)
Wow, great example! Any chance of doing an example of one point fix to an object while the other point follows the mouse?
-
Re: Spring-chain: A walrus example :)
A two point fix example could be very nice. Your example is great ! :)
An improvement could be to store initial distance of all nodes for prevent the rope to retract in itself. :)
-
Re: Spring-chain: A walrus example :)
its 'inspired' me to make my own version
-
Re: Spring-chain: A walrus example :)
UltimateWalrus: You're just plain crazy! I can't even begin to understand how you figured out how to program that.
-
Re: Spring-chain: A walrus example :)
-
Re: Spring-chain: A walrus example :)
Thanks guys! :D
Quote:
Originally Posted by Sphax
A two point fix example could be very nice. Your example is great ! :)
An improvement could be to store initial distance of all nodes for prevent the rope to retract in itself. :)
The engine's very flexible. All you have to do is set the BigX and BigY values of any node, and you should be able to "fix" as many points on the chain as you want.
For simplicity's sake, I assumed that each spring had an equilibrium at 0 (I don't think there are any real life springs like this though!). To keep the chain from retracting, I could change the spring equilibrium so that the nodes are actually pushed away from eachother when they get too close. Alternatively, I could just make it so there is no resistance until the nodes get a certain distance apart --- kind of like an elastic band.
Maybe I'll post a new example of this stuff if I have time.
Quote:
Originally Posted by Nifflas
UltimateWalrus: You're just plain crazy! I can't even begin to understand how you figured out how to program that.
It's amazing what a few college math courses and some self-directed computer science learning can do for ya! :)
-
Re: Spring-chain: A walrus example :)
Fantastic example! 3x :cool:
I've been wanting something like this for ages. Will try to use it as a rope tied to a horse halter and a wall so when the horse moves his head the rope moves.
Thank you so much for sharing! :grin:
-
Re: Spring-chain: A walrus example :)
Amazing example! Thanks for sharing Walrus! ^_^
-
Re: Spring-chain: A walrus example :)
A really impressive example, and beautiful code.
I should have paid more attention in the math classes, that's for sure! :)
-
Re: Spring-chain: A walrus example :)
Another excellent example from UltimateWalrus. It reminds me of that line object from TGF that never quite worked properly ('cept it works properly).
-
Re: Spring-chain: A walrus example :)
Thanks for the comments guys! I'm flattered! :blush:
Quote:
Originally Posted by Joshtek
Another excellent example from UltimateWalrus. It reminds me of that line object from TGF that never quite worked properly ('cept it works properly).
Actually, that's where I got the idea (if you're talking about what I think you're talking about). There used to be this one object in MMF that was this orange chain that you can swing around (I don't even think you could change the color). It couldn't scroll and it seemed to be affected by some invisible circle in the middle of the frame...
But this method is a lot better, because it can be fully interactive with its surroundings, is easily scrollable, and can basically be used to do anything, because it's done in pure MMF. :)
-
Re: Spring-chain: A walrus example :)
Is it possible to release a more advanced example where two points of the chain (or rope) are fixed and where the rope don't retract in itself ?
I like a lot your example and I think a lot of users want it. :)
Thanks a lot for releasing your great stuff. ;)
-
Re: Spring-chain: A walrus example :)
I belong to the group with "non math mind". :confused:
Now I've tested to have an end fixed but don't understand where/how to do it. I looked for some explanation on bigX in the help department of MMF but found nothing.
Anyone of you smart guys out there give me a clue how to do this?
-
Re: Spring-chain: A walrus example :)
Hint: BigX and BigY is alterable values of the "links"
Awsome example! looks so smooth, and totaly buggfree!
-
Re: Spring-chain: A walrus example :)
Quote:
Originally Posted by Attan
Hint: BigX and BigY is alterable values of the "links"
Yes, I've found that out and have tried different settings but the chain still moves freely. :(
If everyone else knows how to do it I'd appreciate if someone post a line here. Can't be that much code or info. Right? ;)
-
Re: Spring-chain: A walrus example :)
Quote:
Originally Posted by UltimateWalrus
There used to be this one object in MMF that was this orange chain that you can swing around (I don't even think you could change the color).
The chain object? That's the one.
-
Re: Spring-chain: A walrus example :)
amazing !!!!!
wonderfull !! (I don't know enough of english to describe what you are sharing ^^ )
if you want to do multiple fixed points, just add the condition:
- node:id = id_of_the_node_you_wanna_fix
> node: set bigx to xpos_where_you_wanna_fix_thething * 100
> node: set bigy to ypos_where_you_wanna_fix_thething * 100
if you want to make the chain look a bit more realistic set inverse_of_air_friction to 1 (it will look less eslastic (and less fun maybe ^^))
now the important question is how to make it bounce when colliding a backdrop...
-
2 Attachment(s)
Re: Spring-chain: A walrus example :)
Thanks Sylnade for saying how to do that. I've played a little with that and I've tried to add collision detection but it seems to be difficult. :)
-
Re: Spring-chain: A walrus example :)
I originally thought I was just gonna post this and leave it at that... but you guys are so enthusiastic that I went ahead and started making a second example. :) It already includes "spring-equilibrium" implementations that keep the chain from retracting in on itself. It's also got a neat frame where you can click and drag the chain onto "anchors" and stretch it around.
I plan on adding a few more things before I post it though.
Quote:
Originally Posted by Sphax
Thanks Sylnade for saying how to do that. I've played a little with that and I've tried to add collision detection but it seems to be difficult. :)
Nice example! It's good that you guys are getting a basic understanding of how the code works ;)
I'll try making collision detection for my next example. Perfect collision detection would require code so complex that I don't think it's appropriate for MMF. However, I can probably set it up so at least the nodes bounce off walls as they're supposed to.
-
Re: Spring-chain: A walrus example :)
Thanks Sylnade for the suggestion and example how to do it. :)
Quote:
...but you guys are so enthusiastic that I went ahead and started making a second example.
Can things get any better than this? What a guy! :cool:
-
Re: Spring-chain: A walrus example :)
you are welcome sphax
what is really great in this engine is that it uses real physic laws, so if you have studyed it a little bit it's really easy to understand ^^
thanks for trying to add collision detection, i didn't manage to do that myself
i think you'll see your name in many credits now ^^
-
Re: Spring-chain: A walrus example :)
Your example is so great UltimateWalrus that I think I'll add a news in the French website "Clikmaniak" about this. ;)
What should be nice for the future of this example is :
- Spring equilibrium
- Collision detection (Spring -> Obstacle) (spring bounce on fixed obstacle)
- Collision detection (Obstacle -> Spring) (obstacle bounces on spring which is a little stretched by obstacle weight)
- Multi springs
- Rupture if too stretched
I like a lot your example and I think this could be a must have in every games made with MMF2 (for making hook, bridge, etc).
-
Re: Spring-chain: A walrus example :)
Hi guys!
Just a little update on the status of my second example. It's got spring equilibrium, anchoring to multiple points, and simple collision detection so far.
I like Sphax's suggestions, so I'm gonna go ahead and implement them. I already have an idea in my head about how to do multiple springs and "rupturing," and I think making it so weights can be attached to the spring should be relatively easy.
After I add these features, it should be ready to go!
-
Re: Spring-chain: A walrus example :)
-
Re: Spring-chain: A walrus example :)
Indeed, quite impressive. Thanks for the last two examples Sphax.
-
Re: Spring-chain: A walrus example :)
I love you UltimateWalrus ! ^^
I'm very impatient to see this new version of your example. :)
-
Re: Spring-chain: A walrus example :)
You are amazing! Things like this shouldn't be possible to do in mmf2! Btw, I'm in love with that water thing you have in the link in your signature, but i can't download the source...
-
Re: Spring-chain: A walrus example :)
Quote:
Originally Posted by Attan
You are amazing! Things like this shouldn't be possible to do in mmf2! Btw, I'm in love with that water thing you have in the link in your signature, but i can't download the source...
I finally fixed the UltimateWalrus examples page, so you should be able to download all the examples now! If you have any problems, please let me know :)
-
Re: Spring-chain: A walrus example :)
any news on your example UW ? :)