Texture in Objects. Loadanimmesh

Blitz3D Forums/Blitz3D Programming/Texture in Objects. Loadanimmesh

msx123(Posted 2005) [#1]
Hi,

I have a problem. I have any B3D with animation, and loaded with "LoadAninMesh" instruction. I want add a texture with "EntityTexture" instruction, and don't work.

But, if I load this object without animation, with "LoadMesh" I can add this texture, no problems.

Why?

The version of blitz3d is to the 1.90.

Thanks, in advance.


KuRiX(Posted 2005) [#2]
You need to iterate through the object hierarchy to find the object you want to texture.

Look for the commands:

CountChildren
GetChild

Good Luck!


msx123(Posted 2005) [#3]
Coool!!

:)

Yes, Works fine.

Thanx Kurix. :)


John Pickford(Posted 2005) [#4]
Here's my function for this. It applies the same texture to each child though - possibly not what you want.

Function retexture_anim_mesh (mesh,texture,shin#=0,r=255,g=255,b=255)

	
	For f=1 To CountChildren (mesh)

	
		child=GetChild (mesh,f)
		
		
		If EntityClass (child)="Mesh"
		  
			EntityTexture (child,texture)
			EntityShininess child,shin
			EntityColor (child,r,g,b)
		EndIf
	
		If CountChildren (child) Then retexture_anim_mesh (child,texture,shin,r,g,b)
	
	Next

End Function