Scale a player using the datablock editor
by Jules · in Torque 3D Professional · 05/11/2010 (11:25 pm) · 4 replies
You can scale a player using the datablock editor, but it doesn't save it. I've tried scale in code but it doesn't seem to work. Any idea?
#2
Now in the onAdd function I test if this field is available, if so then set the scale with:
It works for me, and by adding this to .cs of the model you can set different scales for your models.
But isn't it possible in the editor to scale the player? Another way around this problem is to add the model as a static model and rescale this in the editor, then add the scale factors to the onAdd or as above. If you do it this way you have visual control.
05/12/2010 (12:24 am)
I have followed the same way, but I added a dynamic field in the model .cs file, like this: userScale = "x y z";Replace x, y and z with the scale factors.
Now in the onAdd function I test if this field is available, if so then set the scale with:
if(%obj.userScale)
{
%newScale=%obj.userScale;
%obj.setScale(%newScale);
echo("Object " @ %obj @ " scaled to " @ %newScale);
}Note: this is more or less pseudo-code, because right now I don't have access to these files.It works for me, and by adding this to .cs of the model you can set different scales for your models.
But isn't it possible in the editor to scale the player? Another way around this problem is to add the model as a static model and rescale this in the editor, then add the scale factors to the onAdd or as above. If you do it this way you have visual control.
#3
05/12/2010 (12:34 am)
Cheers Richard. Much better way of doing it. Thanks! Yeah, you can re-scale in the editor using the datablock editor by using the scale tool, but it doesn't save it. You can define every other property. Using the dynamic approach seems the best option for now.
#4
05/12/2010 (2:21 am)
No thanks, glad I could help.
Torque Owner Jules
Something2Play
Add this line:
%obj.setScale("2 2 2"); // for example.It would be good if you scale the player in the editor for it to add this line in under PLAYERDATA. Something visual would be easier to scale correctly.