Custom Shape Mod
by Duncan Gray · 04/03/2005 (9:43 am) · 84 comments
Download Code File
This resource still works in TGE 1.51 if you copy/past from the included pdf file.
This mod involves applying scaling factors to vertices according to the bone nodes to which they are attached. Basically you select a bone, select a scaling factor for x,y,z and those scaling factors get stored in a vector list which is instanced for each character/vehicle/shape. Additionally, the scaling is fully ghosted on the clients making it possible for each player to enter the game with his own unique character proportions, visible to all other players.
It's thus also possible to dynamically scale body proportions while mid game. So if a player bumps his head, you can make his head swell up etc.
The idea is to let the user scale his character proportions which then get saved in prefs. When he joins a game, his details get sent to the server which then ghosts the character settings to all the clients.
It's not only of use for characters. The mod is done mostly in shapebase.cc which is the base class for all shapes. Therefore, in theory, you can make trees, vehicles etc and scale sections of the shape as long as you place a "bone" in that area and assign a vertex group to the bone. You will then be able to select that bone and scale the participating verticies dynamically, at run time, from script which can add a whole new element to your game.
[Edit]
Updated the readme.txt with notes about TGE 1.4
[edit]
For a solution to the "floating above ground" problem, go here
SCREENSHOTS
[edit]
I also made an update, in the shapebase.cc section, use the following rather than the version in the pdf
That will let you do server script based (or console) scaling by issuing the setScalePerBone(bla) command.
You don't need all the guiplayerview changes if you only want to scale from server script. Example, when a player spawns, give a random 30% scale change to relevant body parts so that all players look a little different from each other.
This resource still works in TGE 1.51 if you copy/past from the included pdf file.
This mod involves applying scaling factors to vertices according to the bone nodes to which they are attached. Basically you select a bone, select a scaling factor for x,y,z and those scaling factors get stored in a vector list which is instanced for each character/vehicle/shape. Additionally, the scaling is fully ghosted on the clients making it possible for each player to enter the game with his own unique character proportions, visible to all other players.
It's thus also possible to dynamically scale body proportions while mid game. So if a player bumps his head, you can make his head swell up etc.
The idea is to let the user scale his character proportions which then get saved in prefs. When he joins a game, his details get sent to the server which then ghosts the character settings to all the clients.
It's not only of use for characters. The mod is done mostly in shapebase.cc which is the base class for all shapes. Therefore, in theory, you can make trees, vehicles etc and scale sections of the shape as long as you place a "bone" in that area and assign a vertex group to the bone. You will then be able to select that bone and scale the participating verticies dynamically, at run time, from script which can add a whole new element to your game.
[Edit]
Updated the readme.txt with notes about TGE 1.4
[edit]
For a solution to the "floating above ground" problem, go here
SCREENSHOTS
[edit]
I also made an update, in the shapebase.cc section, use the following rather than the version in the pdf
ConsoleMethod( ShapeBase, setScalePerBone, void, 6, 6, "ShapeBase.setScalePerBone( x, y, z , bone-index )" )
{
argc;
Point3F scale;
S32 boneNdx = dAtoi(argv[5]);
TSShapeInstance* si = object->getShapeInstance();
scale.set(strtod(argv[2],(char **)NULL),strtod(argv[3],(char **)NULL),strtod(argv[4],(char **)NULL));
si->setScalePerBone( scale, boneNdx );
char DNA[20];
dSprintf(DNA,sizeof(DNA) ,"%03u %1.2f %1.2f %1.2f" ,boneNdx,scale.x,scale.y,scale.z);
object->setDNA(DNA);
}That will let you do server script based (or console) scaling by issuing the setScalePerBone(bla) command.
You don't need all the guiplayerview changes if you only want to scale from server script. Example, when a player spawns, give a random 30% scale change to relevant body parts so that all players look a little different from each other.
About the author
#82
Also, all child nodes will be scaled as well, so be aware.
Haven't used this mod in a couple of years, but despite what anyone says if done right it works great over a network in TGE 1.5.2.
05/05/2009 (4:19 pm)
Skeleton nodes can be scaled on x,y,z coords individually.Also, all child nodes will be scaled as well, so be aware.
Haven't used this mod in a couple of years, but despite what anyone says if done right it works great over a network in TGE 1.5.2.
#83
I have got the code to compile and even got the gui working, but I move the sliders around and nothing.
I can exit the app and return to it with the sliders still in the position I left them, so the error isn't there.
I have had a similar problem with 'Applying Materials by Mesh Name' everything appears to work exept theres no visual change.
anyone any ideas? or is it just a 1.8.1 error?
07/03/2009 (7:41 am)
anyone got this working in 1.8.1?I have got the code to compile and even got the gui working, but I move the sliders around and nothing.
I can exit the app and return to it with the sliders still in the position I left them, so the error isn't there.
I have had a similar problem with 'Applying Materials by Mesh Name' everything appears to work exept theres no visual change.
anyone any ideas? or is it just a 1.8.1 error?
#84
04/17/2012 (5:09 pm)
Does anyone have this resource or is there an updated version of it anywhere? 
Torque Owner Tyler Slabinski
I have a question, is it possible to make it not just scale, but move? Like making the player have a hunch-back, or having an odd shaped sword?
Like literally pulling and moving vertices connected to bones from it?