Changing skins
by AlexanderSLG · in Torque Game Engine · 06/26/2007 (8:25 am) · 3 replies
Does anybody know of a way of changing a TSStatic's texture? for what I've seen each dts is loaded only once, and I need to put different skins to the different objects (two max in a scene), so even if changing the DTS's skin worked (which I haven't been able to do) it sounds like that'd change all objects in the scene. So is there a way of doing this from engine (as in opposed to scripting + changing to ShapeBase + using datablocks, since this would require heavy refactoring)
About the author
#2
By the way, I'm making a single player, and all that networking's a pain. In particular, does anybody know why is this if(!isGhost()) required?:
not ghosting some objects that will be part of the terrain anyways makes it really slow
06/26/2007 (9:39 am)
It won't, already tried. It seems like we've taken the wrong approach all over, and we would have been better off using StaticShape instead of TSStatic, but we needed to add some functionality to the engine and creating datablocks from C didn't sound like the greatest approach then... but now new functionality is neededBy the way, I'm making a single player, and all that networking's a pain. In particular, does anybody know why is this if(!isGhost()) required?:
void ShapeBase::setSkinName(const char* name)
{
if (!isGhost()) {
if (name[0] != '[[4f3e1af67b159]]') {
// Use tags for better network performance
// Should be a tag, but we'll convert to one if it isn't.
if (name[0] == StringTagPrefixByte) {
mSkinNameHandle = StringHandle(U32(dAtoi(name + 1)));not ghosting some objects that will be part of the terrain anyways makes it really slow
#3
The function isGhost() returns true if it's called from client. So, the skin setting is done on "server", and then - the networking take care of "letting know about skin change" to all clients connected. Even if it's single-game, the server-client structure still applies, as the Torque is built from it's base as a "client/server" application.
06/29/2007 (6:20 am)
if (!isGhost()) {mean that the code can be called only on server-side.The function isGhost() returns true if it's called from client. So, the skin setting is done on "server", and then - the networking take care of "letting know about skin change" to all clients connected. Even if it's single-game, the server-client structure still applies, as the Torque is built from it's base as a "client/server" application.
Torque 3D Owner Randy Condon
Default Studio Name
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=12853
Been meaning to give it a try, but haven't had a chance yet. (There was also a forum thread about it somewhere).
Not sure if it will work with TSStatics.
Good luck.