Game Development Community

How do I turn on and off submeshes on a character?

by Chris · in Torque 3D Professional · 06/01/2010 (11:29 am) · 3 replies

I am trying to turn on and off integrated submeshes such as clothing, cloaks, armor, hair, etc that are part of character models inside Torque

These submeshes should be effected by animation when enabled and such

#1
06/01/2010 (11:51 am)
The function you're looking for is setMeshHidden():

%somePlayer.setMeshHidden("pants", true); //No pants!
%somePlayer.setMeshHidden("pants", false); //Pants!
#2
06/01/2010 (11:55 am)
One more question then -- is it possible to set the texture for a submesh? To say something like "pants", "human_pants_red"

Also you might have to correct me here but it looks like this applies to everyone with the same datablock as their shape so I can't do this to a individual player
#3
06/01/2010 (4:41 pm)
@Chris: Submeshes can be hidden on the shapeinstance level, so you can use that on an individual player. However, it is only exposed to console in ShapeBase I believe, so by default you could not do this for ie. a TSStatic.

Changing the material is a bit trickier. To achieve that, you need to clone the shape's material list, so not every single shape instance using the same list gets its material changed, and then assign the correct material in place of the old one for the shape in question. By default, every instance of a shape uses the same material list. It preserves resources.