Can Gearify be used in script?

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

Can Gearify be used in script?

Postby Xray » Mon Jul 02, 2012 4:30 am

I want to spawn a circle, and I also want to gearify it. I searched multiple forum threads to no avail, so I was hoping that someone could show me a sample script for spawning a circle and immediately gearifying it (if that's even possible!).

By the way, please don't tell me to spawn a gear instead of spawing a circle and then gearifying it. I have my reasons for doing it that way!. :crazy: (I'll explain later what I'm up to if it works)

Thanks!
User avatar
Xray
 
Posts: 501
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

Re: Can Gearify be used in script?

Postby Nxdt » Mon Jul 02, 2012 1:29 pm

I don't think you can, but you could spawn a circle then delete the circle and spawn a gear in its place.
User avatar
Nxdt
 
Posts: 1019
Joined: Mon Aug 31, 2009 6:32 pm
Location: Scotland!

Re: Can Gearify be used in script?

Postby Xray » Mon Jul 02, 2012 5:05 pm

Nxdt wrote:I don't think you can, but you could spawn a circle then delete the circle and spawn a gear in its place.


Hi Nxdt -- Thanks for your reply! Here is what I am trying to do. I noticed through experimentation that when I do multiple "Gearity's" on a circle, the first gearify turns it into a gear as it's supposed to do, but then if I do another gearify on the gear, it starts to look rather jaggered. Then as I do more and more gearify's on the resulting object, it gets very funky looking. Eventually, what started out as a circle turned into a gear, now looks like a gear that was put therough a metal cruncher! Apparently, the gearify function cannot handle gearifying a gear that's been previously gearified! :problem: I wanted to use that problem to my advantage by spawning some of those weird looking geometries and using them to make artificial flames, etc. But if Gearify cannot be done in Thyme script, then I'll work on some other way of making realistic-looking flames.

Thanks!
User avatar
Xray
 
Posts: 501
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

Re: Can Gearify be used in script?

Postby tatt61880 » Mon Jul 02, 2012 5:59 pm

Hi, Xray
What purpose do you want gearified gear?
Image
NOTE: I'm not an Algoryx member.
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
User avatar
tatt61880
[Most Helpful Person 2010]
 
Posts: 1150
Joined: Mon Aug 31, 2009 5:45 pm
Location: Tokyo, Japan

Re: Can Gearify be used in script?

Postby Xray » Mon Jul 02, 2012 6:35 pm

tatt61880 wrote:Hi, Xray
What purpose do you want gearified gear?
Image


I just happened to notice that when you Gearify a gear numerous times, it creates a shape that can only be described as torn, crunched, and mangled! So, if you were to gearify the gear that you show in your post, the shape will get more mangled with each iteration. I had an idea to use those ugly shapes to synthesize an object exploding. I've seen other people's attempts at making explosions, and they typically spawn lots of circles that blast away from each other. The effect does not looke very good in my opinion. But if the gearified shapes can be used in script, then I believe that the resulting shapes would make much more realistic-looking explosions.

Thanks
User avatar
Xray
 
Posts: 501
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

Re: Can Gearify be used in script?

Postby Ivan » Sat Jul 21, 2012 10:24 am

Hi, Xray!
Here is my idea. You could make a few of these funky shapes, copy them one by one (and paste into an external editor to make it easier to edit some properties of the object), and then make functions (or an action array) containing the code of the objects to be stored using the console.
A function would look like this.
Code: Select all
scene.my.funkyshape = {Scene.addPolygon {
    surfaces := [[[-0.18228316, 0.33452892], [-0.17544097, 0.27038670], [-0.16859877, 0.20624423], [-0.16175663, 0.14210200], [-0.15491438, 0.077959776], [-0.14807224, 0.013817549], [-0.14123005, -0.050324917], [-0.13438785, -0.11446714], [-0.17030776, -0.14739370], [-0.20622772, -0.18032026], [-0.19425446, -0.24617338], [-0.18228120, -0.31202674], [-0.17030793, -0.37788010], [-0.15833467, -0.44373322], [-0.13139474, -0.39883327], [-0.10445482, -0.35393333], [-0.080508232, -0.40182662], [-0.056561530, -0.44971991], [-0.032614946, -0.49761319], [-0.016151607, -0.44822335], [0.00031173229, -0.39883327], [0.016775131, -0.34944320], [0.033238471, -0.30005336], [0.079136133, -0.31801343], [0.12503386, -0.33597326], [0.17093152, -0.35393333], [0.17093146, -0.28808022], [0.17093146, -0.22222686], [0.17093152, -0.15637374], [0.14698482, -0.12344718], [0.12303811, -0.090520620], [0.17691791, -0.048614025], [0.23079777, -0.0067074299], [0.19886893, 0.033203602], [0.16694015, 0.073114634], [0.13501137, 0.11302567], [0.18739462, 0.14595222], [0.23977780, 0.17887902], [0.29216099, 0.21180558], [0.34454429, 0.24473214], [0.29216099, 0.24772549], [0.23977780, 0.25071883], [0.18739462, 0.25371194], [0.13501137, 0.25670528], [0.10507810, 0.29462075], [0.075144887, 0.33253622], [0.045211732, 0.37045169], [0.051197052, 0.41235662], [0.057182431, 0.45426178], [0.027249217, 0.42432857], [-0.0056760907, 0.37045026], [-0.038601398, 0.31657195], [-0.060552597, 0.36246943], [-0.082503676, 0.40836740], [-0.10445482, 0.45426488], [-0.14935464, 0.44528508], [-0.19425446, 0.43630505], [-0.15534127, 0.40337825], [-0.11642808, 0.37045169], [-0.14935565, 0.35249019]]];
    collideSet := 1;
    colorHSVA := [200, 0.8, 1, 1];
    pos := scene.my.pos;
}}
Last edited by Ivan on Sat Jul 21, 2012 6:32 pm, edited 1 time in total.
User avatar
Ivan
 
Posts: 203
Joined: Tue Oct 06, 2009 2:01 pm
Location: Croatia

Re: Can Gearify be used in script?

Postby Xray » Sat Jul 21, 2012 4:22 pm

Hi Ivan!,
That's a GREAT idea, and it works very well too! I played around with it soon after I read your post, and I think I'll be able to use that script in some of my scenes. THANKS VERY MUCH! :thumbup:
User avatar
Xray
 
Posts: 501
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

Re: Can Gearify be used in script?

Postby Ivan » Sat Jul 21, 2012 6:34 pm

I am glad I could help. :)
User avatar
Ivan
 
Posts: 203
Joined: Tue Oct 06, 2009 2:01 pm
Location: Croatia


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 2 guests