Rotate and move transform
#2
I have quickly checked the code and did not find a reason why the translation would not be shown. However, the way you apply transformations is not correct - if you have multiple transformations, they should be apply with first applying scale, then rotation and finally translation. If you translate the object before rotating it, the object will be moved away from the center of rotation (0,0,0) and this will create a different rotation then it would be if the objects would be first rotated and then translated.

To solve that I would advise you that for each 3D object you create a Transform3DGroup and add a RotateTransform3D and a TranslateTransform3D to the group - then assign a new instance of that Transform3DGroup to each 3D object in your scene. When you have a rotation or movement then just adjust the already applied translation or rotation. This way you will be also able to read the already applied rotation and when starting a rotation you will be able to rotate the ModelRotator to already rotated angles.

Another option is to use StandardTransform3D object from Ab3d.Utilities namespace. It provides TranslateX, TranslateY, TranslateZ, ScaleX, ScaleY, ScaleZ, RotateX, RotateY and RotateZ properrties. Note that because it is not possible to derive from Transform3D, this object cannot be assigned to Transform property. Instead the StandardTransform3D provides a public Transform of type MatrixTransform3D that can be assigned to the object's Transform property. 

The StandardTransform3D can be assigned to the Tag property (when using objects from BaseVisual3D). If you are working on Model3D objects or ModelVisual3D objects that doe not provide Tag property, you will need to define a Disctionary<Model3D,StandardTransform3D> that will link the Model3D and StandardTransform3D.
Andrej Benedik
  


Messages In This Thread
Rotate and move transform - by kreativasas - 06-22-2020, 04:32 PM
RE: Rotate and move transform - by abenedik - 06-23-2020, 05:06 PM
RE: Rotate and move transform - by kreativasas - 08-04-2020, 04:25 PM
RE: Rotate and move transform - by abenedik - 08-05-2020, 08:55 AM
RE: Rotate and move transform - by kreativasas - 08-05-2020, 10:40 AM
RE: Rotate and move transform - by abenedik - 08-05-2020, 06:39 PM
RE: Rotate and move transform - by kreativasas - 08-10-2020, 10:37 AM

Forum Jump:


Users browsing this thread:
1 Guest(s)