EntiyAlpha/Color on AnimMesh
Blitz3D Forums/Blitz3D Programming/EntiyAlpha/Color on AnimMesh
| ||
EntityAlpha and EntityColor don't seem to have any effect on a mesh loaded with LoadAnimMesh. When I just used LoadMesh, they work. The mesh is a b3d generated by lwconvert. Have others encountered this problem? Is there a workaround? |
| ||
Try using FindChild() or GetChild() ( FindChild is easier ) to locate the pieces you want to use EntityAlpha and EntityColor with. When you use LoadAnimMesh, it uses a hierarchy with a pivot at the base, and I think you're EntityAlpha'ing and EntityColor'ing that pivot. |
| ||
Of course! Thank you! |
| ||
Okay, now CountChildren is only returning "1", so I can only get at the first model in the heirarchy. Maybe this is an oddity of how LWConvert does it's thing? The B3D is available at the link below, if anyone can enlighten me. http://www.optibrain.co.uk/downloads/bot1_legs.B3D |
| ||
That's why I suggested using FindChild, because then you don't have to recursively trundle through the hierarchy manually. If you really want/need to do it this way, JFK's entry in the code archives will show you the structure of your mesh : http://www.blitzbasic.com/codearcs/codearcs.php?code=615 |
| ||
*blink* Okay, I'm gonna study that snippet more closely. Oh, wait, I get it. Of course. "Child" only works for one "level", it needs to be called for each part and so on and so on. Okay, I can dig it. As you say, recursive trundling ahoy. Bloody hell, all I want to do is make it transparent when it's not selected in the editor. |
| ||
yes, you need to create your collection of recursively working Commands of things like EntityAlpha, EntityFX, EntityColor etc. Example: Function EntityAnimColor(m,r,g,b) If EntityClass$(m)="Mesh" EntityColor m,r,g,b Endif For i=1 to CountChildren(m) ww=GetChild(m,i) EntityAnimColor(ww,r,g,b) Next End Function or Function EntityAnimAlpha(m,a#) If EntityClass$(m)="Mesh" EntityAlpha m,a# Endif For i=1 to CountChildren(m) ww=GetChild(m,i) EntityAnimAlpha(ww,a#) Next End Function (The EntityClass check is done because you cannot set Alpha on bones, and children may be bones sometimes) |
| ||
Wow, crikey. Okay, thanks guys. Guess I'd better get my groove on and write a few of these bad boys. Better figure out texturing, I guess that's not gonna be as straightforward either. I guess UU3D copes with it okay, so it'd just be a case of applying the same texture to a bunch of different parts. |