Friction Console Script (question)

About advanced scenes, and the Thyme scripting language used in Algodoo.

Friction Console Script (question)

Postby jrderksen » Thu Apr 28, 2011 3:02 am

How would I script a box to change the friction of a circle using console and oncollide?
My idea: When the box gets hit with an object, it changes the friction of a circle from 0 to 2.00
:?: :?:
User avatar
jrderksen
 
Posts: 68
Joined: Wed Dec 22, 2010 4:50 am
Location: British Columbia, Canada

Re: Friction Console Script (question)

Postby RicH » Thu Apr 28, 2011 5:18 am

What have you tried doing anyway? You won't always get your answers just by asking, you have to figure them out yourself too.

Anyway, use a scene variable(scene.my.blah) that changes whenever that box gets hit. Input that scene variable into the friction of the circle. There you go. That's the pseudo-code. Either you wait for someone to make the actual code for you, or you try to discover it. You're choice.
Millions of voices suddenly cried out in terror, and were suddenly silenced. Something terrible has happened.
User avatar
RicH
[Funniest Person 2010]
 
Posts: 2043
Joined: Tue Sep 01, 2009 9:01 am

Re: Friction Console Script (question)

Postby jrderksen » Thu Apr 28, 2011 6:12 am

^Ok, thanks. That helps. I actually did try to figure it out, I just thought I might try asking, so I could get a better idea.
User avatar
jrderksen
 
Posts: 68
Joined: Wed Dec 22, 2010 4:50 am
Location: British Columbia, Canada

Re: Friction Console Script (question)

Postby RicH » Thu Apr 28, 2011 6:43 am

You're learning. Very good. 8-)
Millions of voices suddenly cried out in terror, and were suddenly silenced. Something terrible has happened.
User avatar
RicH
[Funniest Person 2010]
 
Posts: 2043
Joined: Tue Sep 01, 2009 9:01 am

Re: Friction Console Script (question)

Postby Someone Else » Thu Apr 28, 2011 8:14 am

What I would do however, is this:
I would set it up so the circle in question actually gets hit. I would also set the controllerAcc of the thing that changes the friction to 36.4.

In the onCollide of the circle goes this code:
Code: Select all
{e.other.friction == 36.8} ? {friction = 200} : {}
Matthias Wandel is epic, in my humble opinion.
I love my brain...
TC42 wrote:Also, your sig is too big, please change it.

ARE YA HAPPY NOW?????

Thymechanic/Phundamentalist

Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
User avatar
Someone Else
 
Posts: 1147
Joined: Sun Nov 21, 2010 10:53 pm
Location: The Milky Way Galaxy

Re: Friction Console Script (question)

Postby jrderksen » Fri Apr 29, 2011 1:52 am

^Interesting. I ended up just using hinges which brake when you hit a key (This is for a spring-engine cars' gearing).
User avatar
jrderksen
 
Posts: 68
Joined: Wed Dec 22, 2010 4:50 am
Location: British Columbia, Canada

Re: Friction Console Script (question)

Postby Someone Else » Fri Apr 29, 2011 4:11 am

Ooops... I just realized I made a mistake in my code. :oops:
It should be
Code: Select all
{e.other.controllerAcc == 36.8} ? {friction = 200} : {}
Matthias Wandel is epic, in my humble opinion.
I love my brain...
TC42 wrote:Also, your sig is too big, please change it.

ARE YA HAPPY NOW?????

Thymechanic/Phundamentalist

Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
User avatar
Someone Else
 
Posts: 1147
Joined: Sun Nov 21, 2010 10:53 pm
Location: The Milky Way Galaxy


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 7 guests