Bug/Scale Gizmo Axis
#1
Hi,

I've ran into an issue with the group of ModelScalar, ModelMover and ModelRotator in the case of transformation hierarchies and moving in local transformation space.

The issue is, that the axis does not correspond to the axis you drag your mouse in (the transformation matrix of the Model* is not taken into consideration when doing raycast for events). ModelMover and ModelRotator has a workaround: ModelMover can be created anew anytime you want to move object, ModelRotator has 3 static variables that can be set, but ModelScalar has none of it.

Added attachment: So in the case, when Y-axis is rotated into a position of X-axis, you have to drag your mouse vertically on the screen, which does not correspond to the Y-axis being horizontal.

Best regards,
Janovský Roman


Attached Files Thumbnail(s)
   
#2
I have improved the Ab3d.PowerToys library so that all ModelScalar, ModelMover and ModelRotator support the same way of setting the axes: it is possible to set the static Vector3D properties to set the axes when the default constructor is used (for example in XAML) or create each object with passing the custom axes values to the constructor.

This change will be available in the next version. If you want to have that before the next release, write me a PM or email and I will send you a pre-release version.
Andrej Benedik
#3
Note:
the new version works with setting new axes but they still need to be parallel with the original axes - so you can change the direction of axes and their order.

To use custom transformation and orient the ModelScalarVisual3D in any direction, you can add transformation to ModelScalarVisual3D  (or ModelMoverVisual3D or ModelRotatorVisual3D) - for example:

Code:
<visuals:ModelScalarVisual3D x:Name="SelectedModelScalar"
                            AxisLength="60" CenterBoxWidth="16" InnerBoxWidth="4" OuterBoxWidth="12"
                            CenterBoxColor="Gray" XAxisColor="Red" YAxisColor="Green" ZAxisColor="Blue"
                            IsCenterBoxShown="{Binding ElementName=IsCenterBoxShownCheckBox, Path=IsChecked}"
                            IsXAxisShown="{Binding ElementName=IsXAxisShownCheckBox, Path=IsChecked}"
                            IsYAxisShown="{Binding ElementName=IsYAxisShownCheckBox, Path=IsChecked}"
                            IsZAxisShown="{Binding ElementName=IsZAxisShownCheckBox, Path=IsChecked}">

   <visuals:ModelScalarVisual3D.Transform>
       <Transform3DGroup>
           <RotateTransform3D x:Name="ScaleRotation">
               <RotateTransform3D.Rotation>
                   <AxisAngleRotation3D Axis="0 1 0" Angle="30" />
               </RotateTransform3D.Rotation>
           </RotateTransform3D>
           <TranslateTransform3D x:Name="ScaleTranslation" />
       </Transform3DGroup>
   </visuals:ModelScalarVisual3D.Transform>

</visuals:ModelScalarVisual3D>

After that in code instead of setting the SelectedModelScalar.Position, set the translation:

Code:
//SelectedModelScalar.Position = boxPosition;
ScaleTranslation.OffsetX = boxPosition.X;
ScaleTranslation.OffsetY = boxPosition.Y;
ScaleTranslation.OffsetZ = boxPosition.Z;


Of course, you can change the RotateTransform3D with any other transform.
Andrej Benedik
  


Forum Jump:


Users browsing this thread:
1 Guest(s)