Layers
14 posts • Page 1 of 1
Layers
There are a great algodoo undocumented feature - layer.
To create a layer, use the command
To put a geom on some layer, you need to specify layer id when you create it:
or to draw interactively, set active layer by entering command
Changing the properties of the layer can be done via the same command - scene.addLayer
All that could be very handy if you want to make few locations or just a picture with no performance impact and so on.
To create a layer, use the command
- Code: Select all
Scene.addLayer {visible: = true; color: = [1, 1, 1, 1]; id: = 2; dynamic: = false};
To put a geom on some layer, you need to specify layer id when you create it:
- Code: Select all
Scene.addbox {layer: = 2; ...}
or to draw interactively, set active layer by entering command
- Code: Select all
scene.selectLayer(2)
Changing the properties of the layer can be done via the same command - scene.addLayer
- visibility - to show layer or not
color - a factor for all the colors in the layer (eg [1,1,1,0.5] will do a translucent
dynamic - whether physics cheat on this layer, or it just a "picture"
All that could be very handy if you want to make few locations or just a picture with no performance impact and so on.
Last edited by Kilinich on Thu Jan 24, 2013 8:08 am, edited 3 times in total.
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Layers
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Layers
Interesting. How did you learn about this information?
- s_noonan
- Posts: 61
- Joined: Tue Mar 30, 2010 2:25 am
Re: Layers
s_noonan wrote:Interesting. How did you learn about this information?
Saw that commands in console then pressing tab after "scene."
Then tried to use and looked into scene's code.
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Layers
Thanks. I learned something new today!
- s_noonan
- Posts: 61
- Joined: Tue Mar 30, 2010 2:25 am
Re: Layers
wow,marvelous ! you are a teacher of algodoo and all of us are students of you!
waiting for semester break to come...
-
faytree - Posts: 947
- Joined: Mon Nov 05, 2012 1:37 pm
- Location: Selangor, Malaysia
Re: Layers
Хорошая работа!
This is great information! Thanks for sharing.
This is great information! Thanks for sharing.
-
Xray - Posts: 500
- Joined: Sun Jun 17, 2012 6:12 am
- Location: USA
Re: Layers
I played around with layers after learning about this, and found that you can do some very interesting things with it!
FUN STUFF!!!
FUN STUFF!!!
Last edited by Xray on Thu Jan 24, 2013 5:51 pm, edited 1 time in total.
-
Xray - Posts: 500
- Joined: Sun Jun 17, 2012 6:12 am
- Location: USA
Re: Layers
But remember, this is experimental and unsupported feature!
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Layers
Questions about Layers:
1. If I add a new layer (for example, layer id = 1), will the original "default" layer automatically become layer 0 (zero)?
2. If I add textures and geomtries on the default layer (0), and then add and select layer 1, I find that I cannot add existing geometries (such as "Phunlets") to the scene on layer 1. Is that because the phunlets were created while on layer 0? How can I add Phunlets and other pre-existing geometries on a newly created layer?
3. Once layers have been added to a scene, is there a way to REMOVE them?
Thanks
1. If I add a new layer (for example, layer id = 1), will the original "default" layer automatically become layer 0 (zero)?
2. If I add textures and geomtries on the default layer (0), and then add and select layer 1, I find that I cannot add existing geometries (such as "Phunlets") to the scene on layer 1. Is that because the phunlets were created while on layer 0? How can I add Phunlets and other pre-existing geometries on a newly created layer?
3. Once layers have been added to a scene, is there a way to REMOVE them?
Thanks
-
Xray - Posts: 500
- Joined: Sun Jun 17, 2012 6:12 am
- Location: USA
Re: Layers
1. Yes, default is always 0
2. Any entity can be added to any layer with "layer = id" property
3. I did'n find how to do it
2. Any entity can be added to any layer with "layer = id" property
3. I did'n find how to do it
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Layers
3. Yes, in the background edit menu, the last item is "layers". In the layers menu, the red X deletes layer.
Human horse pasture expansion OpenGL Book Hall
Kwon owned Version (C) 2002-2008
-
guyboy - Posts: 80
- Joined: Mon Aug 31, 2009 6:19 pm
- Location: Ḻ̘̬͕͍͚̥͈͚͖̝̜̲͕̭̩ͅ
Re: Layers
guyboy wrote:3. Yes, in the background edit menu, the last item is "layers". In the layers menu, the red X deletes layer.
I clicked on the background edit menu, and I do not see "layers". I'm using V2.0.2 b15 Algodoo for Education. Maybe you are using a different version?
-
Xray - Posts: 500
- Joined: Sun Jun 17, 2012 6:12 am
- Location: USA
Re: Layers
in the new beta, v2.1.0 b4 there is a layers menu when you left-click the background.
Basically, there are only 10 types of people in the world. Those who know binary, and those who don't.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
-
monstertje3 - Posts: 343
- Joined: Sat Sep 05, 2009 4:29 pm
- Location: N-H, NL
14 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest