Hi to all!
I am tweaking Ebberts' collission detector for a project. There are going to be a lot of layers in the comp, and some of them will work as obstacles for a collision. I want to make some of these layers obstacles, and one object to collide should detect them. So the ideal would be
if (L.effect("IsObject")(Checkbox))
to check every layer in every frame before going to the collision check. But if a layer doesn't have an effect called IsObject, the expression won't work. Is there a way to detect if a layer has an effect with particular name so I don't have to create this effect on every layer?
Regards
Can I check if a layer has an effect?
-
- Posts: 320
- Joined: June 26th, 2004, 10:01 am
- Location: Folsom, CA
- Contact:
Here's an example that should count the layers with the checkbox:
Dan
Code: Select all
n = 0;
for (i = 1; i <= thisComp.numLayers; i++){
if (i == index) continue; // skip myself
try{
thisComp.layer(i).effect("isObject")("Checkbox");
}catch (e){
continue;
}
n++;
}
n