Game Development Community

SetSkin for Materials Of Model

by Robert \"Roswell_r\" · in Torque Game Engine · 04/16/2008 (4:10 am) · 2 replies

Ive been reading up on the SetSkinName function and some of the resources around the TGE community and Ive concluded the current SetSkinName with the use of base naming is not suitable for what I need.

I however did find this resource: www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=14366

Which adds a extra parameter to the SetSkinName detailing the previous 'skin' name which allows me to set a different texture for that 'skin' and does not use base naming. This seems great, compiles fine but I can not actually get it working.

I create a datablock and staticshape then i setSkinName('torso1_black", "torso1_blue"); but nothing gets changed. Im asuming something isn't been updated in the rendering process or sending the information to the client because when i use ListSkins() which is another function of the above resource it indicates the change to the resource list.

What id like to know is if anyone knows of a better way to do this and have it also updating on other clients. The DTS model I have is made up of 6 torso meshes named torso1-6 and 3 or so leg meshes named legs1-3 etc... each of the category of meshes torso, legs, head etc... all have 1 material assigned to them in hope that I can just change the texture for that material as I am also using the following resource to hide the unused torso, legs and head meshes:

www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5421

Thx in advance for your replies.

#1
04/18/2008 (4:07 am)
We are using this combination successfully, so it will work.

You might check your console logs for messages like this:

******Original Skin base.boots was not found

Which would indicate that the texture intended to be replaced couldn't be found in the model.

We have to check that the target object has been ghosted to the client before we try to change meshes. Speaking of which, I don't think setSkinName will work unless done on the server.

You might also try making sure the mesh name is a tagged string -- In my experience this is only necessary for setting the texture of an Image, not for a Static Shape, but it's worth a try. Code might looks something like this:

%skinTag = addTaggedString(%newTexture);
     %targetObj.setSkinName(%baseTexture, %skinTag);
#2
04/20/2008 (4:36 am)
I emailed you Ed Zavada if you could please check back and reply. Thanks!