Translate, rotate and scale
#4
(04-23-2021, 11:48 AM)GraPhiX Wrote: Thank you for you quick response, i am an idiot i did not know there were DXEngine samples i was still using powertoy samples,  once i seen the sample i got it working :) going through all the samples now

I spoke too soon :(
_modelMover works
_modelRotator works
_modelScaler not working :(

Code:
Public Sub ShowModelMover()

       If MoveAsset = True Then
           HideModelRotator()
           HideModelScalar()
       End If


       If _selectedVisual3D Is Nothing OrElse _standardTransform3D Is Nothing Then Return

       EnsureModelMover()
       '_modelMover.ShowMovablePlanes = False
       _modelMover.Position = _standardTransform3D.GetTranslateVector3D().ToPoint3D
       Dim length As Double = (_modelMover.Position - Camera1.GetCameraPosition).Length
       Dim worldSize As Size = CameraUtils.GetPerspectiveWorldSize(New Size(100, 100), length, Camera1.FieldOfView, New Size(_viewport3D.ActualWidth, _viewport3D.ActualHeight))

       _modelMover.AxisLength = (worldSize.Width + worldSize.Height) '/ 2
       _modelMover.AxisRadius = (_modelMover.AxisLength * 0.02)
       _modelMover.AxisArrowRadius = (_modelMover.AxisRadius * 2)


       If Not _viewport3D.Children.Contains(_modelMover) Then
           _viewport3D.Children.Add(_modelMover)
           _modelMover.SubscribeWithEventManager3D(_eventManager3D)
       End If


   End Sub
Code:
Public Sub ShowModelRotator(sender As Object, e As ModelRotatedEventArgs)
       If RotateAsset = True Then
           HideModelMover()
           HideModelScalar()
       End If


       If _selectedVisual3D Is Nothing OrElse _standardTransform3D Is Nothing Then Return

       EnsureModelRotator(sender, e)
       _modelRotator.Position = _standardTransform3D.GetTranslateVector3D().ToPoint3D
       Dim lookDirectionDistance As Double = (_modelRotator.Position - Camera1.GetCameraPosition()).Length
       Dim worldSize = Ab3d.Utilities.CameraUtils.GetPerspectiveWorldSize(New Size(100, 100), lookDirectionDistance, Camera1.FieldOfView, New Size(_viewport3D.ActualWidth, _viewport3D.ActualHeight))
       _modelRotator.InnerRadius = (worldSize.Width + worldSize.Height) / 2 '* 0.8
       _modelRotator.OuterRadius = _modelRotator.InnerRadius * 1.1
       If Not _viewport3D.Children.Contains(_modelRotator) Then
           _viewport3D.Children.Add(_modelRotator)
           _modelRotator.SubscribeWithEventManager3D(_eventManager3D)
       End If
   End Sub
Code:
Public Sub ShowModelScalar(sender As Object, ARGSS As ModelScaledEventArgs)
       If ScaleAsset = True Then
           HideModelMover()
           HideModelRotator()
       End If

       If _selectedVisual3D Is Nothing OrElse _standardTransform3D Is Nothing Then Return

       EnsureModelScalar(sender, ARGSS)
       _modelScalar.Position = _standardTransform3D.GetTranslateVector3D().ToPoint3D
       Dim length As Double = (_modelScalar.Position - Camera1.GetCameraPosition).Length
       Dim worldsize As Size = CameraUtils.GetPerspectiveWorldSize(New Size(100, 100), length, Camera1.FieldOfView, New Size(_viewport3D.ActualWidth, _viewport3D.ActualHeight))

       _modelScalar.AxisLength = (worldsize.Width + worldsize.Height) '/ 2
       _modelScalar.InnerBoxWidth = _modelScalar.AxisLength * 0.03
       _modelScalar.OuterBoxWidth = _modelScalar.InnerBoxWidth * 3
       _modelScalar.CenterBoxWidth = _modelScalar.InnerBoxWidth * 5

       If Not _viewport3D.Children.Contains(_modelScalar) Then
           _viewport3D.Children.Add(_modelScalar)
           _modelScalar.SubscribeWithEventManager3D(_eventManager3D) 'error on this line
       End If

   End Sub

the error is BC30456 'SubscribeWithEventManager3D' is not a member of 'ModelScalarVisual3D'
Kevan Hampson
  


Messages In This Thread
Translate, rotate and scale - by GraPhiX - 04-22-2021, 06:31 PM
RE: Translate, rotate and scale - by abenedik - 04-23-2021, 08:16 AM
RE: Translate, rotate and scale - by GraPhiX - 04-23-2021, 11:48 AM
RE: Translate, rotate and scale - by GraPhiX - 04-23-2021, 11:55 AM
RE: Translate, rotate and scale - by GraPhiX - 04-23-2021, 12:06 PM
RE: Translate, rotate and scale - by abenedik - 04-26-2021, 11:44 AM
RE: Translate, rotate and scale - by GraPhiX - 04-26-2021, 12:13 PM

Forum Jump:


Users browsing this thread:
1 Guest(s)