Changing the texture of a skinned mesh

Blitz3D Forums/Blitz3D Programming/Changing the texture of a skinned mesh

John Pickford(Posted 2005) [#1]
I use the following code in my game to retexture animated meshes.

Function retexture_anim_mesh (mesh,texture,shin#=0)


	
	For f=1 To CountChildren (mesh)

	
		child=GetChild (mesh,f)
		EntityTexture (child,texture)
		EntityShininess child,shin
	
		If CountChildren (child) Then retexture_anim_mesh (child,texture,shin)
	
	Next

End Function


It applies the same texture to every child within the entity. This works on multi-part objects I have (tanks with turrets and guns etc.).

On a 'skinned' model built in max I get an error "entity is not a model' and the game exits.

Any ideas?

Is there any way I can predict whether a child will cause that error?


Beaker(Posted 2005) [#2]
Use:
If EntityClass(mesh)="Mesh"
..on the children.


John Pickford(Posted 2005) [#3]
Thankyou!


John Pickford(Posted 2005) [#4]
Update: That worked a treat.

Entityclass isn't listed in my help. I must have an out of date docs file or something.


BlitzSupport(Posted 2005) [#5]
John, have you installed this?


John Pickford(Posted 2005) [#6]
I hadn't but I have now. Cheers.