Game Development Community

FixShapeAspect not working

by Steve Self · in Torque Game Engine · 12/06/2005 (7:49 pm) · 3 replies

In fxShapeReplicator, when I check "FixShapeAspect", it doesn't do what it is supposed to do: it doesn't make the width, height, and length of the object the same. Any way to fix this? I think it is a bug, but I could be wrong. Any fix for this? Thanks, it would be really nice to have this feature fixed.

#1
12/07/2005 (8:20 am)
It isn't supposed to make those values the same.

It's supposed to do what the name says: "fix the shape aspect ratio" when random scaling is used. Instead of choosing a random value for each axis, it applies the same value to all 3 axis, keeping the random scale without deforming the shape.
#2
12/07/2005 (11:48 am)
Yes, I know that is what it is supposed to do, I guess I described it wrong in the first post. Let me rephrase what I said: When I check "FixShapeAspect", the length, width, and height are still each different values in each shape. What I mean is: I have a mushroom object I modeled and I want each mushroom to have a minimum scale of 0.75, 0.75, 0.75 and a maximum of 2, 2, 2. Even when I check "FixShapeAspect", the scaling of one of the mushrooms might be 0.8, 1.8, 1.3 rather than something like 1.4, 1.4, 1.4.

I hope this is more clear.

http://home.earthlink.net/~gumgo/Mushrooms.JPG
#3
12/14/2005 (5:17 am)
OK. fxShapeReplicator.cc have little bug with FixShapeAspect.
there not exist stream->writeFlag() and stream->readFlag() for fixshapeaspect option.
that this cause why doesnt work.
You should make this:

add this in:
U32 fxShapeReplicator::packUpdate(NetConnection * con, U32 mask, BitStream * stream)

stream->writeInt(mFieldData.mOuterRadiusX, 32);                 // Shapes Outer Radius X.
 stream->writeInt(mFieldData.mOuterRadiusY, 32);                 // Shapes Outer Radius Y.
[b]stream->writeFlag(mFieldData.mFixShapeAspect);[/b]    // << ADD
 mathWrite(*stream, mFieldData.mShapeScaleMin);                  // Shapes Scale Min.
 mathWrite(*stream, mFieldData.mShapeScaleMax);                  // Shapes Scale Max.
 mathWrite(*stream, mFieldData.mShapeRotateMin);                 // Shapes Rotate Min.

and add this in:
void fxShapeReplicator::unpackUpdate(NetConnection * con, BitStream * stream)
mFieldData.mOuterRadiusX            = stream->readInt(32);          // Shapes Outer Radius X.
mFieldData.mOuterRadiusY            = stream->readInt(32);          // Shapes Outer Radius Y.
[b]mFieldData.mFixShapeAspect			= stream->readFlag();[/b] // << ADD
mathRead(*stream, &mFieldData.mShapeScaleMin);                      // Shapes Scale Min.
mathRead(*stream, &mFieldData.mShapeScaleMax);                      // Shapes Scale Max.
mathRead(*stream, &mFieldData.mShapeRotateMin);                     // Shapes Rotate Min.

Now FixShapeAspect works for me.
I hope so, should work for you too.
cya.