Example of using morphs
by Joe Bussell · in General Discussion · 10/05/2007 (1:49 pm) · 7 replies
I am wondering if anybody has seen an actual example of using morphs. I have seen many posts about how to create morphs in 3dsMax but none of them detail how to use them in a game. Such as how to call them from TorqueScript based on events and such.
Let me know if this sounds wrong.
Let me know if this sounds wrong.
#2
%xfrm = %shape.getTransform();
%lx = %getWord(%xfrm,0);
%ly = %getWord(%xfrm,1);
%lz = %getWord(%xfrm,2);
%rx = %getWord(%xfrm,3);
%ry = %getWord(%xfrm,4);
%rz = %getWord(%xfrm,5);
%lx += %dist;
%angle += 1.0;
%rd = %angle;
if ($grow)
{
if (%scale < 5.0)
%scale += 0.3;
else
$grow = false;
}
else
{
if (%scale > 3.0)
%scale -= 0.3;
else
$grow = true;
}
%shape.setScale(%scale SPC %scale SPC %scale);
%shape.setTransform(%lx SPC %ly SPC %lz SPC %rx SPC %ry SPC %rz SPC %rd);
schedule(200,0,AnimShape, %shape, %dist, %angle, %scale);
"From 3DGPAi1"
-Josh
10/08/2007 (7:20 pm)
What about the dimensions did you want to change? If it's just scale, you can do that no problem with something like:%xfrm = %shape.getTransform();
%lx = %getWord(%xfrm,0);
%ly = %getWord(%xfrm,1);
%lz = %getWord(%xfrm,2);
%rx = %getWord(%xfrm,3);
%ry = %getWord(%xfrm,4);
%rz = %getWord(%xfrm,5);
%lx += %dist;
%angle += 1.0;
%rd = %angle;
if ($grow)
{
if (%scale < 5.0)
%scale += 0.3;
else
$grow = false;
}
else
{
if (%scale > 3.0)
%scale -= 0.3;
else
$grow = true;
}
%shape.setScale(%scale SPC %scale SPC %scale);
%shape.setTransform(%lx SPC %ly SPC %lz SPC %rx SPC %ry SPC %rz SPC %rd);
schedule(200,0,AnimShape, %shape, %dist, %angle, %scale);
"From 3DGPAi1"
-Josh
#3
In 3dsMax my artist was able to have morph targets work for this. Where all of the individual morphs would cascade through the nodes and you could manipulate the dimensions by tweaking these values. I'm just not sure how to do this via Torque.
10/09/2007 (2:14 pm)
I do need it to be an actual morph because I will need to apply it to more complex objects which cannot just change scale, such as rectangular elbows and cylindrical elbows. I also need height width and length to all be independently adjustable, so I don't think that I can achieve this with simple scaling. In 3dsMax my artist was able to have morph targets work for this. Where all of the individual morphs would cascade through the nodes and you could manipulate the dimensions by tweaking these values. I'm just not sure how to do this via Torque.
#4
10/09/2007 (2:33 pm)
...
#5
but the method Josh suggested will work fine for simple scaling of width height and depth all independently.
10/09/2007 (2:54 pm)
Yes, if you want to have fancy "growing" versus scaling, where maybe the arms of a character stretch but the hands don't get bigger, plain scaling won't work,but the method Josh suggested will work fine for simple scaling of width height and depth all independently.
#6
And Milkshape AFAIK, but haven't tested that one.
10/23/2007 (4:42 pm)
GreenBriar Toolbox exporter.And Milkshape AFAIK, but haven't tested that one.
#7
10/23/2007 (5:09 pm)
Geh? ..non uniform scale of bones? .. worked for me :/
Joe Bussell
Default Studio Name
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=8464
But I am unsure if this was ever added to the engine or if any exporter support was added for it. Specifically for 3dsMax.
Basically what I am trying to do is to change the dimensions of a rectangle in real time using whatever means is best or available for Torque. Any thoughts/ideas would be appreciated.