03-30-2020, 12:53 PM
(This post was last modified: 03-30-2020, 02:38 PM by kreativasas.)
(03-30-2020, 12:15 PM)close Wrote: The upper method takes the current transormation and applies the new one to the obj.transformation w/o any global variables. If you apply an global variable as transformation the reference will be stored inside the obj.transformation and this results in an behavior like you describe. Are you using VB?
yes VB.
I try to follow the example but nothing... when i apply transformation on the second obj also the first is moved... i'm getting crazy!
Here is my code:
Code:
sub createcontrol(numdente1)
Dim mymodelrotator As New ModelRotatorVisual3D
mymodelrotator.Position = pointcenter
mymodelrotator.Transform = mygroupx
mymodelrotator.InnerRadius = 10
mymodelrotator.OuterRadius = 10.3
mymodelrotator.CircleWidth = 0.3
AddHandler mymodelrotator.ModelRotateStarted, AddressOf started
AddHandler mymodelrotator.ModelRotated, AddressOf rotated
AddHandler mymodelrotator.ModelRotateEnded, AddressOf endrotate
_EventManager3D.RegisterEventSource3D(visualEvent)
End sub
Sub started(sender As Object, args As ModelRotatedEventArgs)
_startRotate.Angle = args.RotationAngle
Dim rotatetransform As New RotateTransform3D(_startRotate)
addtransform(dentehit.visualhit, rotatetransform)
End Sub
Sub rotated(sender As Object, args As ModelRotatedEventArgs)
_startRotate.Angle = args.RotationAngle
End sub
Sub addtransform(myvisual As Visual3D, mytransform As Transform3D)
If myvisual.Transform Is Nothing Then
myvisual.Transform = mytransform
End If
Dim transformgroup As New Transform3DGroup
transformgroup.Children.Add(myvisual.Transform)
myvisual.Transform = transformgroup
transformgroup.Children.Add(mytransform)
End Sub
