How to spawn squares with scripting?
7 posts • Page 1 of 1
Re: How to spawn squares with scripting?
EN: Its any command for function SUBTRACT, like when i manualy click it in menu?
So i can use it for working miller/drill.
SK: Je nejaky prikaz pre pouzivanie funkcie ODCITAT ,ako keby som klikol na tuto funkciu manualne v menu?
Chcel by som to pouzit pre funkcnu frezu/vrtak.
Sorry for my poor English but I slovak.
So i can use it for working miller/drill.
SK: Je nejaky prikaz pre pouzivanie funkcie ODCITAT ,ako keby som klikol na tuto funkciu manualne v menu?
Chcel by som to pouzit pre funkcnu frezu/vrtak.
Sorry for my poor English but I slovak.
- JakubKubo
- Posts: 18
- Joined: Thu Mar 12, 2015 6:27 pm
Re: How to spawn squares with scripting?
Ultragamer564 wrote:Please help me! I want to know how you make squares with scripting or with a onCollide that can turn circles to squares. Does anyone know?
Thanks!
~Ultragamer564
Open algodoo and any text document (example: openpad, onenote, word).
In algodoo select object (example: circle, box, plane, ets.) press CTRL+C click in text document and press CTRL+V
It will copy all information about your object and you can edit it...try to edit only few things (like color, etc.) and try if it works.
When you edit it press CTRL+A for select all and copy it by CTRL+C and paste in algodoo by CTRL+V.
I do it always when i need anything what you can´t make in algodoo (like powered motor by left mouse button).
Sorry for my poor English but I slovak.
- JakubKubo
- Posts: 18
- Joined: Thu Mar 12, 2015 6:27 pm
Re: How to spawn squares with scripting?
The importand info you need is following:
adding circle: scene.addCircle({})
adding rectangle/box: scene.addBox({})
tracer: scene.addPen({}) and so on, you get the idea
Inside the {} you can write attribute statements. If they are missing, the standart valuse of the scene are used. The most frequently used values are:
friction
restitution
color(HSVA)
collideset
size/radius
vel
pos
and so on. You can basically set any value you can see in the script window for the spawned figure. Remember to write <variable> := <value> instead of a = b as you will alter the spawning figure otherwise. So if you write colorHSVA = [1,1,1,1] it will make both the spawning figure(i.e. something that uses onCollide to spawn the new shape) as the spawned shape white.
adding circle: scene.addCircle({})
adding rectangle/box: scene.addBox({})
tracer: scene.addPen({}) and so on, you get the idea
Inside the {} you can write attribute statements. If they are missing, the standart valuse of the scene are used. The most frequently used values are:
friction
restitution
color(HSVA)
collideset
size/radius
vel
pos
and so on. You can basically set any value you can see in the script window for the spawned figure. Remember to write <variable> := <value> instead of a = b as you will alter the spawning figure otherwise. So if you write colorHSVA = [1,1,1,1] it will make both the spawning figure(i.e. something that uses onCollide to spawn the new shape) as the spawned shape white.
- FRA32
- Posts: 227
- Joined: Wed Dec 03, 2014 9:51 pm
Re: How to spawn squares with scripting?
I make this a looong time ago, this works perfectly but i want to make a hinges on two object, what is already on scene (for scene car factory where i add hinge on wheel and car) i try use laser to detect ID of both object, but it dont work :/ can you help me?
This make circle onto square and hinge in the middle of both: (its good? )
(e)=>{
Scene.addBox({
size := [0.5, 0.5];
entityID := 280;
pos := [0, 0.25];
geomID := 3072467;
zDepth := +inf
});
Scene.addCircle({
entityID := 303;
pos := [0, 0.25];
radius := 0.1875;
geomID := 3074424;
zDepth := +inf
});
Scene.addHinge({
geom0 := 3074424;
geom0pos := [0, 0];
geom1 := 3072467;
geom1pos := [0, 0];
entityID := 304;
zDepth := +inf;
size := 0.12;
})
}
This make circle onto square and hinge in the middle of both: (its good? )
(e)=>{
Scene.addBox({
size := [0.5, 0.5];
entityID := 280;
pos := [0, 0.25];
geomID := 3072467;
zDepth := +inf
});
Scene.addCircle({
entityID := 303;
pos := [0, 0.25];
radius := 0.1875;
geomID := 3074424;
zDepth := +inf
});
Scene.addHinge({
geom0 := 3074424;
geom0pos := [0, 0];
geom1 := 3072467;
geom1pos := [0, 0];
entityID := 304;
zDepth := +inf;
size := 0.12;
})
}
- JakubKubo
- Posts: 18
- Joined: Thu Mar 12, 2015 6:27 pm
Re: How to spawn squares with scripting?
If you want to specify the geom id for a hinge while spawning 2 shapes add a id counter to the script executor. Make it start at something like 200000 and everytime it summons a car let it make the first piece the id of the ocunter, the second the id of the counter PLUS ONE, and then use these 2 values for the hinge in the geom1 and geom2 attribute. Then increase the counter by 2 and you can repeat the process over and over
- FRA32
- Posts: 227
- Joined: Wed Dec 03, 2014 9:51 pm
Re: How to spawn squares with scripting?
You cannot force object to specific ID, if yes, show me in scene
- JakubKubo
- Posts: 18
- Joined: Thu Mar 12, 2015 6:27 pm
7 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 5 guests