AB4D Forum
model scalar - Printable Version

+- AB4D Forum (https://forum.ab4d.com)
+-- Forum: Products Forums (https://forum.ab4d.com/forumdisplay.php?fid=4)
+--- Forum: Ab3d.PowerToys (https://forum.ab4d.com/forumdisplay.php?fid=9)
+--- Thread: model scalar (/showthread.php?tid=4270)



model scalar - kreativasas - 07-26-2021

hi guys,
 i need an help.
i use modelscalar and it works.
but if i rotate the object (and rotate the modelscalar with the obj) i need to transform not only 1 axe but 2 or 3 (it depends by the rotation) to don't morph the object.

How i can do?


RE: model scalar - abenedik - 07-27-2021

The order of transformations is important. If you first rotate the model and then scale it, then the rotated model will be scaled and this can stretch the model in a way that is not intended.

To apply multiple transformations first check that the center of the 3D model is at coordinates (0, 0, 0) - around this point the model will be rotated and from that point the scaling will be applied. This is also called a pivot point. If the pivot point is somewhere else, then you can first apply a translation to move the center to that point.

Then add scale transformations, after that add rotation and finally add a translation.

You can also use StandardTransfrom3D that comes with Ab3d.PowerToys and is not a transformation from WPF 3D objects model. This requires a different usage pattern - see the "Utilities / StadardTransform3D sample" for more information.


RE: model scalar - kreativasas - 07-27-2021

ok but i need to apply many transformation:
first i need to move, then rotate and at last scale....
so when the obj is scaled it stretches.... is there a way to scale the obj after rotation without stretching it?


RE: model scalar - abenedik - 07-28-2021

Why do you think that you "first i need to move, then rotate and at last scale"?

Of you want to have stretched and rotated object, then you will need to first scale it and then rotate it - this is the order that needs to be in the Transform3DGroup - for example:

Code:
var transform3DGroup = new Transform3DGroup();
transform3DGroup.Children.Add(new ScaleTransform3D(2, 1, 1)); // scale x for 2x
transform3DGroup.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0,1,0), 45))); // rotate by 45 degrees around Y axis