alpha on a pivot?
Blitz3D Forums/Blitz3D Beginners Area/alpha on a pivot?
| ||
I'm trying to fade out a collection of shapes that have the same pivot as the parent, but I can't use entityAlpha on the pivot. It gives me an error saying "Entity is not a model". Is there an easy way to fade out the entire group some how? I really don't want to have to fade every single shape individually. |
| ||
You can't do what you ask. The alpha of the parent mesh will have no bearing on it's children, only scale / rotation etc.. This is the only way I can think of and it involves going through them all individually. Stevie for c = 1 to countchildren( pivot ) child = getchild( pivot, c ) if entityclass$( child ) = "Mesh" entityalpha child, .25 endif next |
| ||
You might need to make that a recursive function, Stevie, just incase the children, have children. |
| ||
Probably best to put those objects into a type, then you can loop the type etc |
| ||
But, in doing that, how do you know whats parented to what? You'll still need to use the getchildren() command. I agree however, that storing every mesh you load in a type collection is an excellent idea :o) |
| ||
cool, that'll work. thanks. |
| ||
boomboom Probably best to put those objects into a type, then you can loop the type etc Ross C: I agree however, that storing every mesh you load in a type collection is an excellent idea :o) I like the idea. Every time you add a mesh, you do a mymesh.typethingee = new typethingee and then you can FOR-EACH through the whole list, regardless of whether the mesh in question is a parent or child, or even a seventh-generation recursive child. Sweet! |
| ||
You still have the problem of finding each mesh parented though. So, you would need to use the recursive getchild method to find all the children :o) Types are ace for storing your meshes though. |
| ||
Ross C: If each mesh is added to the type collection as it gets added to the pivot, then it shouldn't be a problem, right? Another possibility I see, though, is instead of using a pivot, use a tiny mesh as the parent, and hideentity it, but otherwise use it as the parent, and then set the alpha for it. |
| ||
I think it's just easier and requires less coding to use the recursive getchild :o) Your way would work, but freeing an entity. You'd need to search through the type collection and remove any meshes/entities that are parented also. I think for simplicity and ease of use, the getchild is the best way to go. But, it's always good to throw about other ideas :o) |