Layers of bodies in scene
Posted: Fri Aug 01, 2014 8:37 am
I am wondering how make layers work in my scene in a simplest way, before iforce2d deliver "Display layers" feature.
My idea is basically:
1. All of bodies belonging to the specific layer name with layerX_* prefix. Preferably write a script that can name/rename/change layer to all selected bodies with provided prefix.
2. Write scripts hooked to the 0-9 keys on keyboard, that can show specific layer (ex. layer1_* for 1 key) and hide rest of the bodies from layers (bodies without layerX_ prefix would be immune to this script).
3. Write a script that color bodies by specific layer name
4. Write a script that set collision filtering between layers so layers doesn`t collide with themselves and bodies without layer colliding only with layer1.
That should (in theory) make working with layers much simpler. What I need to do to write some scripts.
What do you think about this? Do you have your own system to work with layers? What do you do differently?
Do you have some scripts to share?
P.S. Can I make some scripts run automatic? It would be very helpful for script 3.
My idea is basically:
1. All of bodies belonging to the specific layer name with layerX_* prefix. Preferably write a script that can name/rename/change layer to all selected bodies with provided prefix.
2. Write scripts hooked to the 0-9 keys on keyboard, that can show specific layer (ex. layer1_* for 1 key) and hide rest of the bodies from layers (bodies without layerX_ prefix would be immune to this script).
3. Write a script that color bodies by specific layer name
4. Write a script that set collision filtering between layers so layers doesn`t collide with themselves and bodies without layer colliding only with layer1.
That should (in theory) make working with layers much simpler. What I need to do to write some scripts.
What do you think about this? Do you have your own system to work with layers? What do you do differently?
Do you have some scripts to share?
P.S. Can I make some scripts run automatic? It would be very helpful for script 3.