Page 3 of 5

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Sat Feb 06, 2010 1:11 pm
by xplane80
You can get the density of the object from e.geom/e.other .density
The Mass, I am not as sure. If you know the area of the object, then just multiply the area with the density and then you get the mass.

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Thu Feb 11, 2010 10:23 pm
by TimTheOne
xplane80 wrote:You can get the density of the object from e.geom/e.other .density
The Mass, I am not as sure. If you know the area of the object, then just multiply the area with the density and then you get the mass.


Yea i already knew the Density thing, however density is something else.

but how can you know the area? lol

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Thu Feb 11, 2010 11:34 pm
by Rideg
SizeX * SizeY = area. Though you can't access the sizes via e.other/geom.size :problem:

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Thu Feb 11, 2010 11:38 pm
by KarateBrot
Rideg wrote:SizeX * SizeY = area. Though you can't access the sizes via e.other/geom.size :problem:

Unfortunately it's not just x*y. That's just the area of a rectangle. If you have unreguar polygons you have difficult calculations to solve.

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Thu Feb 11, 2010 11:45 pm
by Rideg
forgot that srry :P , It's not impossible but then I think you would have to mutiply all the surfaces am I right??

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Thu Feb 11, 2010 11:52 pm
by KarateBrot
I don't know how they do it in algodoo. For geometries with an infinite amount of surfaces you have to integrate many parts and then add / substract them from each other so that in the end you get the overall area. With polygons like in algodoo with a finite amount I think you can use the trapezium algorithm. Because there can be so much surfaces it's only possible with a computer. To calculate it yourself would take forever :D

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Fri Feb 12, 2010 9:21 am
by gradyfitz
KarateBrot wrote:I don't know how they do it in algodoo. For geometries with an infinite amount of surfaces you have to integrate many parts and then add / substract them from each other so that in the end you get the overall area. With polygons like in algodoo with a finite amount I think you can use the trapezium algorithm. Because there can be so much surfaces it's only possible with a computer. To calculate it yourself would take forever :D

Overlap would be difficult to calculate i assume, but area of a single surface is a relatively straightforward function.

Code: Select all
Scene.my.For100In = (a, r, c)=>{
Scene.my.For10In(a,((r + 10) > (c + 10) ? {c + 10} : {c}),(c - (c % 10)));
((c + 10) < (r + 10)) ? {Scene.my.For10In(a,((r + 10) > (c + 10 + 10) ? {c + 20} : {c + 10}),(c + 10 - (c % 10)))} : {};
((c + 20) < (r + 10)) ? {Scene.my.For10In(a,((r + 10) > (c + 20 + 10) ? {c + 30} : {c + 20}),(c + 20 - (c % 10)))} : {};
((c + 30) < (r + 10)) ? {Scene.my.For10In(a,((r + 10) > (c + 30 + 10) ? {c + 40} : {c + 30}),(c + 30 - (c % 10)))} : {};
((c + 40) < (r + 10)) ? {Scene.my.For10In(a,((r + 10) > (c + 40 + 10) ? {c + 50} : {c + 40}),(c + 40 - (c % 10)))} : {};
((c + 50) < (r + 10)) ? {Scene.my.For10In(a,((r + 10) > (c + 50 + 10) ? {c + 60} : {c + 50}),(c + 50 - (c % 10)))} : {};
((c + 60) < (r + 10)) ? {Scene.my.For10In(a,((r + 10) > (c + 60 + 10) ? {c + 70} : {c + 60}),(c + 60 - (c % 10)))} : {};
((c + 70) < (r + 10)) ? {Scene.my.For10In(a,((r + 10) > (c + 70 + 10) ? {c + 80} : {c + 70}),(c + 70 - (c % 10)))} : {};
((c + 80) < (r + 10)) ? {Scene.my.For10In(a,((r + 10) > (c + 80 + 10) ? {c + 90} : {c + 80}),(c + 80 - (c % 10)))} : {};
((c + 90) < (r + 10)) ? {Scene.my.For10In(a,((r + 10) > (c + 90 + 10) ? {c + 100} : {c + 90}),(c + 90 - (c % 10)))} : {};
((c + 90) < (r + 10)) ? {Scene.my.For100In(a,r,(c + 100))} : {}};

Scene.my.For10In = (a, r, c)=>{
((c < r)) ? {a(c);} : {};
((c + 1) < r) ? {a(c + 1);} : {};
((c + 2) < r) ? {a(c + 2);} : {};
((c + 3) < r) ? {a(c + 3);} : {};
((c + 4) < r) ? {a(c + 4);} : {};
((c + 5) < r) ? {a(c + 5);} : {};
((c + 6) < r) ? {a(c + 6);} : {};
((c + 7) < r) ? {a(c + 7);} : {};
((c + 8) < r) ? {a(c + 8);} : {};
((c + 9) < r) ? {a(c + 9);} : {};
((c + 9) < r) ? {Scene.my.For10In (a,r,(c + 10))} : {}};

Scene.my.Pro02CheckSize = (name)=>{TEMParray := name ++ ["THISISTHEENDOFTHEARRAYHERE"];Found := false;Size := 0;Scene.my.For100In((x)=>{found ? {} : {(((TEMParray(x)) + "") == "THISISTHEENDOFTHEARRAYHERE" ? {Found = true} : {};Size = x}},(100),0);(Size - 1)};

Scene.my.Area = (aoxy)=>{Scene.my.AreaIn(aoxy,0,0.0,Scene.my.Pro02CheckSize(aoxy))};
Scene.my.AreaIn = (aoxy,c,a,s)=>{c <= s ? {Scene.my.AreaIn(aoxy,(c + 1),(a + (aoxy(c)(0) * ((aoxy((c + 1) % (s + 1))(1)) - (aoxy(((c - 1) < 0 ? (s) : (c-1)))(1))))),s)} : {a/2.0}};


Working out multi-surface polygon area is not particularly easy to do if you don't know which are negatives and which are positives, but if you do (I suppose it wouldn't be too difficult), it's not too hard to do, by just subtracting negatives and adding positives.

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Sun Apr 18, 2010 1:12 pm
by Rrobba
Very helpful when it comes to my scripting and nice that you've listed everything together.

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Thu May 27, 2010 6:05 am
by mbartelsm
I need help, the tracers don't spawn
Code: Select all
(e)=>{
    scene.addcircle({
        radius := 0.06;
        density := 12;
        pos := e.pos;
        color := [1.0, 0.9763333, 0.29000002, 1.0];
        drawcake := false;
        attraction := -10000;
        collideset := 64;
        onhitbylaser := ((e)=>{attraction = 0})
    });
    scene.addpen({
        size := 0.11;
        color := [0.8580386, 0.8580386, 0.8580386, 0.175];
        fadetime := 1.0
    });
    scene.addpen({
        size := 0.1;
        color := [1.0, 0.8333333, 0.0, 0.735];
        fadetime := 0.4
    });
    scene.addpen({
        size := 0.09;
        color := [0.8580386, 0.8580386, 0.8580386, 0.37];
        fadetime := 0.6
    });
    scene.addpen({
        size := 0.08;
        color := [0.8580386, 0.14300644, 0.0, 0.682];
        fadetime := 0.1
    })
}

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Thu May 27, 2010 3:38 pm
by Matten
Maybe adding the pos will help?

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Fri Jun 04, 2010 9:47 pm
by Rideg
Code: Select all
(e)=>{
    scene.addcircle({
        radius := 0.06;
        density := 12;
        pos := e.pos;
        color := [1.0, 0.9763333, 0.29000002, 1.0];
        drawcake := false;
        attraction := -10000;
        collideset := 64;
        GeomID := 1;
        onhitbylaser := ((e)=>{attraction = 0})
    });
    scene.addpen({Geom := 1;relPoint := [0.0, 0.0];
        size := 0.11;
        color := [0.8580386, 0.8580386, 0.8580386, 0.175];
        fadetime := 1.0
    });
    scene.addpen({Geom := 1;relPoint := [0.0, 0.0];
        size := 0.1;
        color := [1.0, 0.8333333, 0.0, 0.735];
        fadetime := 0.4
    });
    scene.addpen({Geom := 1;relPoint := [0.0, 0.0];
        size := 0.09;
        color := [0.8580386, 0.8580386, 0.8580386, 0.37];
        fadetime := 0.6
    });
    scene.addpen({Geom := 1;relPoint := [0.0, 0.0];
        size := 0.08;
        color := [0.8580386, 0.14300644, 0.0, 0.682];
        fadetime := 0.1
    })
}
This will solve your problem. I never use pos, just grown to use to use geomIDs. ;)

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Sat Jun 05, 2010 11:12 am
by xplane80
geomIDs are ok but for beginners, I would recommend using pos because it's easier to learn.

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Sat Jun 05, 2010 12:20 pm
by Rideg
It's not a big difference plus if you spawn a circle with a tracer inside an other object then the pen might stick to the object that wasn't spawned.

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Sat Jun 05, 2010 4:45 pm
by Matten
Hmmm..
Maybe something to try, you can spawn hinges far away from the object, is this also possible with tracers?

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Sun Jun 06, 2010 2:09 am
by Rideg
nope ;) they always need to be on the object..

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Mon Jun 07, 2010 5:16 pm
by Rideg
Quick question: Is there a way to set custom default collision group for lasers? :?:

Like draw a laser with "g" as a collision group?

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Mon Jun 07, 2010 5:30 pm
by xplane80
Same as you would with an object, set the collideset to whatever number is needed.

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Mon Jun 07, 2010 6:21 pm
by Rideg
No I mean is there a way to access the default collision groups through the console so when I draw a laser it will have 64 as a collision group.

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Mon Jun 07, 2010 7:52 pm
by xplane80
no

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Mon Jun 07, 2010 7:54 pm
by Rideg
damn, Hope they can implement it ;)

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Mon Jun 07, 2010 8:15 pm
by Matten
Good idea! You can change the deafault values and you can save the "defaults" just like the skins right now.

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Mon Jun 07, 2010 8:36 pm
by Chronos
Or you can just stop being lazy and change it manually.

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Mon Jun 07, 2010 9:22 pm
by Matten
But I mean the defaults for when the scene is running. Example:
You made a machine and you need to input geoms with collideSet CE, it's not handy if everytime you make a new geom for the machine, you put it on the ground and change the collideSet. So if you make the default collision group CE, you can just work normal.

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Mon Jun 07, 2010 9:46 pm
by Chronos
Chronos wrote:stop being lazy

Re: [Thyme][1.5.61]Thyme Command/Variables List

PostPosted: Mon Jun 07, 2010 11:00 pm
by Rideg
I almost never use lasers with 127 as a collision group.