Transform multiple obj
#1
Guys... I'm getting crazy!!

I have some object and, selecting one of them, i need to apply a rotation

I create an AxisAngleRotation3D variable and  a RotateTransform3D variable, created a Transform3DGroup and apply transformation to the first object. (all variables are public)

Everithing works, but if i select another obj when i apply to it the transformation also the first object rotates!
I thought to use a matrix variable with a value for each of the obj:
Code:
Public rotationy As New List(Of AxisAngleRotation3D)
   Public rotationx As New List(Of AxisAngleRotation3D)

   Public rotationz As New List(Of AxisAngleRotation3D)
   Public Transformx As New List(Of RotateTransform3D)
   Public Transformy As New List(Of RotateTransform3D)
   Public Transformz As New List(Of RotateTransform3D)

   Public rotationgroup As New List(Of Transform3DGroup)

But when i change values on, for example rotationx at the same time the value of rotationy and rotationz changes and i don't know why!
Here is my code
Code:
 If args.RotationAxis = ModelRotatorVisual3D.XRotationAxis Then

           rotationx(denteclick).Axis = New Media3D.Vector3D(1, 0, 0)
           rotategumx.Axis = New Media3D.Vector3D(1, 0, 0)
           rotategumx.Angle = -(-args.RotationAngle + rotationprecx)
           trasformgumx.Rotation = rotategumx
           rotationprecx = args.RotationAngle
           rotationx(denteclick).Angle = args.RotationAngle + _startRotateX
           Label8.Text = rotationx(denteclick).Angle
           Transformx(denteclick).CenterX = mybx
           Transformx(denteclick).CenterY = myby
           Transformx(denteclick).CenterZ = mybz
           trasformgumx.CenterX = mybx
           trasformgumx.CenterY = myby
           trasformgumx.CenterZ = mybz
           Transformx(denteclick).Rotation = rotationx(denteclick)

           Label4.Text = args.RotationAngle + _startRotateX
           Label7.Text = args.RotationAngle
           If rotationgroup(denteclick).Children.Contains(Transformx(denteclick)) = False Then rotationgroup(denteclick).Children.Add(Transformx(denteclick))

       End If
       If args.RotationAxis = ModelRotatorVisual3D.YRotationAxis Then

           rotationy(denteclick).Axis = New Media3D.Vector3D(0, 1, 0)
           rotategumy.Axis = New Media3D.Vector3D(0, 1, 0)
           rotategumy.Angle = -(-args.RotationAngle + rotationprecy)
           trasformgumy.Rotation = rotategumy
           rotationprecy = args.RotationAngle
           rotationy(denteclick).Angle = args.RotationAngle + _startRotateY
           Label9.Text = rotationx(denteclick).Angle
           Transformy(denteclick).CenterX = mybx
           Transformy(denteclick).CenterY = myby
           Transformy(denteclick).CenterZ = mybz
           trasformgumy.CenterX = mybx
           trasformgumy.CenterY = myby
           trasformgumy.CenterZ = mybz
           Transformy(denteclick).Rotation = rotationy(denteclick)

           Label4.Text = args.RotationAngle + _startRotateX
           Label7.Text = args.RotationAngle
           '    dentehit.visualhit.transform = transformy(denteclick)
           If rotationgroup(denteclick).Children.Contains(Transformy(denteclick)) = False Then rotationgroup(denteclick).Children.Add(Transformy(denteclick))
           '   If rotationgroupgum.Children.Contains(transformy(denteclick)) = False Then rotationgroupgum.Children.Add(trasformgumy)
       End If
       If args.RotationAxis = ModelRotatorVisual3D.ZRotationAxis Then

           rotationz(denteclick).Axis = New Media3D.Vector3D(0, 0, 1)
           rotategumz.Axis = New Media3D.Vector3D(0, 0, 1)
           rotategumz.Angle = -(-args.RotationAngle + rotationprecz)
           trasformgumz.Rotation = rotategumz
           rotationprecz = args.RotationAngle
           rotationz(denteclick).Angle = args.RotationAngle + _startRotateZ
           Label10.Text = rotationx(denteclick).Angle
           Transformz(denteclick).CenterX = mybx
           Transformz(denteclick).CenterY = myby
           Transformz(denteclick).CenterZ = mybz
           trasformgumz.CenterX = mybx
           trasformgumz.CenterY = myby
           trasformgumz.CenterZ = mybz
           Transformz(denteclick).Rotation = rotationz(denteclick)

           Label4.Text = args.RotationAngle + _startRotateX
           Label7.Text = args.RotationAngle
           If rotationgroup(denteclick).Children.Contains(Transformz(denteclick)) = False Then rotationgroup(denteclick).Children.Add(Transformz(denteclick))
           '  If rotationgroupgum.Children.Contains(transformz(denteclick)) = False Then rotationgroupgum.Children.Add(trasformgumz)
       End If

How i can solve?
  


Messages In This Thread
Transform multiple obj - by kreativasas - 03-27-2020, 06:45 PM
RE: Transform multiple obj - by close - 03-29-2020, 12:29 PM
RE: Transform multiple obj - by kreativasas - 03-30-2020, 12:05 PM
RE: Transform multiple obj - by close - 03-30-2020, 12:15 PM
RE: Transform multiple obj - by kreativasas - 03-30-2020, 12:53 PM
RE: Transform multiple obj - by kreativasas - 03-30-2020, 04:45 PM

Forum Jump:


Users browsing this thread:
1 Guest(s)