Fix for fxShapeReplicator to honor rotation
by Thomas \"Man of Ice\" Lund · 06/03/2004 (5:56 am) · 8 comments
fxShapeReplicator ignores the rotation of the area in which one wants to have the shapes. This is especially annoying if your replication area is long and narrow like mine in this example

This is because the feature was never implemented by Melv. The code below fixes that.
Open your fxShapeReplicator.cc file
In CreateShapes() find the code
and replace with
Recompile and thats it

This is because the feature was never implemented by Melv. The code below fixes that.
Open your fxShapeReplicator.cc file
In CreateShapes() find the code
// Find it a home ...
do
{
// Get the Replicator Position.
ShapePosition = getPosition();
// Calculate a random offset
HypX = RandomGen.randF(mFieldData.mInnerRadiusX, mFieldData.mOuterRadiusX);
HypY = RandomGen.randF(mFieldData.mInnerRadiusY, mFieldData.mOuterRadiusY);
Angle = RandomGen.randF(0, M_2PI);
// Calcualte the new position.
ShapePosition.x += HypX * mCos(Angle);
ShapePosition.y += HypY * mSin(Angle);and replace with
// Find it a home ...
do
{
// Calculate a random offset
HypX = RandomGen.randF(mFieldData.mInnerRadiusX, mFieldData.mOuterRadiusX);
HypY = RandomGen.randF(mFieldData.mInnerRadiusY, mFieldData.mOuterRadiusY);
Angle = RandomGen.randF(0, M_2PI);
// Calcualte the new random position (in local space).
Point3F RandomShapePosLocal;
RandomShapePosLocal.x = HypX * mCos(Angle);
RandomShapePosLocal.y = HypY * mSin(Angle);
// Transform into world space coordinates
Point3F shapePosWorld;
MatrixF objToWorld = getRenderTransform();
objToWorld.mulP(RandomShapePosLocal, &shapePosWorld);
ShapePosition = shapePosWorld;Recompile and thats it
#2
06/03/2004 (1:03 pm)
Do I see a golf course here ? ;)
#3
06/03/2004 (1:57 pm)
Nice. I applied it to fxFoliageReplicator. It's exactly the same idea. Thanks.
#4
Regardless, thanks for the fix. This is definitely annoying as you pointed out.
EdM
06/03/2004 (5:07 pm)
Please submit this as a patch if you can.Regardless, thanks for the fix. This is definitely annoying as you pointed out.
EdM
#5
BTW - Melv pointed out that the shape replicator does not honor the scale settings either. I dont think its very much needed, but just to point out another little feature missing.
06/04/2004 (12:32 am)
I wrote about this in the SDK bug forum and also gave this a "patch" category. I hope someone from GG puts this into HEAD.BTW - Melv pointed out that the shape replicator does not honor the scale settings either. I dont think its very much needed, but just to point out another little feature missing.
#6
06/08/2004 (9:04 pm)
@Luis Ant
#7
06/12/2004 (5:42 am)
Eric, I have not found any problems at all... fxFoliage seems to work properly. I have a quite dense forest made with fxFoliage and nothing fails...
#8
07/30/2006 (4:58 pm)
I didn't have this bug either. 
Torque Owner Desmond Fletcher
fletcher