Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / coil springs

Author
Message
Link102
20
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 24th Jan 2008 16:54 Edited at: 24th Jan 2008 17:04
I fixed a litle coil spring script:

give comments

Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 24th Jan 2008 23:36 Edited at: 24th Jan 2008 23:37
That's great!

Now, is there a way to generalize it a bit? As it stands, it looks like you are hardcoding each vertex in the function. Can you alter the function so that any sized spring can be calculated?

Also the points on either side of the x axis for each spring should be coming closer together. The spring itself shouldn't be getting longer, the angle of the lines should change and the points on either side of x should be getting closer to center y while they are moving along x, not just moving further down along x.

Enjoy your day.
Link102
20
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 25th Jan 2008 11:34 Edited at: 25th Jan 2008 12:09
O the spring drawing is just for reference, but it shouldn't be hard to change it.
I'll tinker with it a bit a see if I can get 2 springs attached to each other.

Dit you know cloth simutalion is entirely based on springs?

edit:
here you go


Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 27th Jan 2008 23:59
could you explain the physics for this? I can't quite wrap my brain around it.

Enjoy your day.
Link102
20
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 28th Jan 2008 14:25
f = − k⁄m * x − b⁄m * v
v = v + f
x = x + v

f = net force
k = spring stiffness
m = mass
x = stretch (not the x posion on the screen)
b = friction
v = velocity

I hope this helpes.
And there's also restlength witch is the length of the spring in pixels when x = 0 (just add it in the drawing routine)

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 29th Jan 2008 11:00 Edited at: 29th Jan 2008 11:03
Wow that's great link
could you make something like that cloth simulation?

Link102
20
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 29th Jan 2008 18:40
I've got pendulums, cloth, bridges and ropes on my to do list

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 29th Jan 2008 21:14
bridges?

Link102
20
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 29th Jan 2008 21:21 Edited at: 29th Jan 2008 21:23
yes a rope bridge. where the bridge will go down where the player is, and where the brige will topple when the player goes to close to the edge

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 29th Jan 2008 21:25
oh cool, in 3D?

Link102
20
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 29th Jan 2008 21:50
of course
it's pretty ambitious, but I'll try anyway

Sinani201
18
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 30th Jan 2008 02:00
COOL! It's like Dark Physics!

Seriously, how do you make the little blue text come up below your message?
Muddleglum
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: New Zealand
Posted: 5th Feb 2008 22:19
that link to the cloth is amazing.


tried to make a simplified version of spring action and ended up with an unexpected oddity . wonder what could be done with it?

it's also not accurate because the distance between points is not corrected for angles.. though I suppose that could be added.

could be added to for 3d objects quite easily. Having the 'gap' vertical imitates gravity I notice, so i suppose horizontal should give a bridge like effect .. if ends fixed ..?? hmm .. must try ..



cheers ... david l

Login to post a reply

Server time is: 2025-06-04 01:53:02
Your offset time is: 2025-06-04 01:53:02