Rotate and move transform
#1
Hi I need an hand.

I'm using a modelmover and a model rotator to move my meshes.

here is the code for modelrotator and modelmover:
Code:
 
AddHandler mymodelrotator(numdente).ModelRotateStarted, AddressOf started
AddHandler mymodelrotator(numdente).ModelRotated, AddressOf rotated
AddHandler mymodelrotator(numdente).ModelRotateEnded, AddressOf endrotate
'handel for modelrotator
 Sub started(sender As Object, args As ModelRotatedEventArgs)
       rotationvector = args.RotationAxis
       
       _startRotate = New AxisAngleRotation3D(rotationvector, 0)
       Dim rotatetransform As New RotateTransform3D(_startRotate)
'create new transformation on modelhit
       addtransform(dentehit.modelhit, rotatetransform)
    End Sub
Sub rotated(sender As Object, args As ModelRotatedEventArgs)

       _startRotate.Angle = args.RotationAngle


   End Sub
Sub addtransform(myvisual As Model3D, mytransform As RotateTransform3D)
       If myvisual.Transform Is Nothing Then
           myvisual.Transform = mytransform
       End If


       Dim transformgroup As New Transform3DGroup


       transformgroup.Children.Add(myvisual.Transform)
       myvisual.Transform = transformgroup
   End Sub


'handler for modelmover

  AddHandler mymodelmover(numdente).ModelMoveStarted, AddressOf startedmove
  AddHandler mymodelmover(numdente).ModelMoved, AddressOf rotatedmove
   AddHandler mymodelmover(numdente).ModelMoveEnded, AddressOf endrotatemove

Sub startedmove(sender As Object, args As EventArgs)

       translate = New Vector3D
       Dim translatetransform As New TranslateTransform3D(translate)
     ' create new transformation on modelhit
       addtransform1(dentehit.modelhit, translatetransform)

   End Sub
Sub rotatedmove(sender As Object, args As Ab3d.Common.ModelMovedEventArgs)
       translate = args.MoveVector3D

   End Sub
Sub addtransform1(myvisual As Model3D, mytransform As TranslateTransform3D)
       If myvisual.Transform Is Nothing Then
           myvisual.Transform = mytransform
       End If


       Dim transformgroup1 As New Transform3DGroup


       transformgroup1.Children.Add(myvisual.Transform)
       myvisual.Transform = transformgroup1

   End Sub


For modelrotator i use rotatetransform3d and everything works perfetctly, but with model mover i use translatetransform3d with the same parameters but nothing change!
Where i'm wrong?
  


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)