Variable springs
13 posts • Page 1 of 1
Variable springs
Hello,
I am new to Algodoo.
I've been playing around for a while and was wondering if its possible to make a spring thats variable.
With that i mean that for example when i press the up arrow on my keyboard the spring increases in length.
And when i press down arrow it decreases.
Thanks in advance
Max
I am new to Algodoo.
I've been playing around for a while and was wondering if its possible to make a spring thats variable.
With that i mean that for example when i press the up arrow on my keyboard the spring increases in length.
And when i press down arrow it decreases.
Thanks in advance
Max
- maxovitsj
- Posts: 3
- Joined: Fri Mar 19, 2010 10:40 pm
Re: Variable springs
No sorry. I think it's impossible.
-
Sonic - Posts: 1467
- Joined: Tue Sep 01, 2009 6:18 pm
- Location: America!!!
Re: Variable springs
It's possible. Get a motor and attach to it 2 boxes with different on-collide codes(one to increase and one to decrease the variable). Now, just set it up so when you press up, only one box would hit and change the variable. Just that concept.
Millions of voices suddenly cried out in terror, and were suddenly silenced. Something terrible has happened.
-
RicH - [Funniest Person 2010]
- Posts: 2043
- Joined: Tue Sep 01, 2009 9:01 am
Re: Variable springs
link to pic: http://i41.tinypic.com/s6re45.jpg
Ok so i made that "wheel" that collides with the boxes and then it does what it supposed to
only thing is that i have to keep pressing enter in the "Length" box for the spring otherwise it doesnt move.
I checked the console for Scene.My.Var and that changes.
Thanks in advance.
Max
- maxovitsj
- Posts: 3
- Joined: Fri Mar 19, 2010 10:40 pm
Re: Variable springs
Type {scene.my.var} instead of scene.my.var.
I found it had a difference.
I found it had a difference.
Millions of voices suddenly cried out in terror, and were suddenly silenced. Something terrible has happened.
-
RicH - [Funniest Person 2010]
- Posts: 2043
- Joined: Tue Sep 01, 2009 9:01 am
Re: Variable springs
Sonic wrote:No sorry. I think it's impossible.
Shut up.
Rich is correct, you need to add some braces ( { } ) around the variable
Also note you can also change the oncollide code to
- Code: Select all
scene.my.var = scene.my.var + 0.5
And every time it is hit the spring will increase in length 0.5
Or you can have fun with thing like
- Code: Select all
scene.my.var = sim.time *0.1
Which will make the spring longer at the rate of time but such code if better used with a laser.
-
Mystery - Posts: 2802
- Joined: Thu Sep 03, 2009 1:16 pm
- Location: Southern Australia
Re: Variable springs
I think he wants it just to be set to predefined lengths. If not then:
http://i39.tinypic.com/10n7y91.png
You could also use gears.
http://i39.tinypic.com/10n7y91.png
You could also use gears.
Millions of voices suddenly cried out in terror, and were suddenly silenced. Something terrible has happened.
-
RicH - [Funniest Person 2010]
- Posts: 2043
- Joined: Tue Sep 01, 2009 9:01 am
Re: Variable springs
maxovitsj wrote: i press the up arrow on my keyboard the spring increases in length.
And when i press down arrow it decreases.
I would say a set up more like this would be better- http://i43.tinypic.com/10wtft3.jpg
-
Mystery - Posts: 2802
- Joined: Thu Sep 03, 2009 1:16 pm
- Location: Southern Australia
Re: Variable springs
Oh right, we have lasers nao.
Millions of voices suddenly cried out in terror, and were suddenly silenced. Something terrible has happened.
-
RicH - [Funniest Person 2010]
- Posts: 2043
- Joined: Tue Sep 01, 2009 9:01 am
Re: Variable springs
RicH wrote:Type {scene.my.var} instead of scene.my.var.
I found it had a difference.
the reason is that { } brackets tell algodoo it's a variable and not only a constant.
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: Variable springs
Ah, okay.
Millions of voices suddenly cried out in terror, and were suddenly silenced. Something terrible has happened.
-
RicH - [Funniest Person 2010]
- Posts: 2043
- Joined: Tue Sep 01, 2009 9:01 am
Re: Variable springs
Adding the { } to the spring's Length box works perfectly =D
thanks
@Mystery, how do you get the laser box to look like that o.0
thanks
@Mystery, how do you get the laser box to look like that o.0
- maxovitsj
- Posts: 3
- Joined: Fri Mar 19, 2010 10:40 pm
Re: Variable springs
I was testing the latest beta.
Its an open beta so feel free to download it.
viewtopic.php?f=24&t=1701
Its an open beta so feel free to download it.
viewtopic.php?f=24&t=1701
-
Mystery - Posts: 2802
- Joined: Thu Sep 03, 2009 1:16 pm
- Location: Southern Australia
13 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 13 guests