Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: (Solved) Having problems converting Attach to Bone Sample to TV6.5  (Read 1770 times)
Dimple
Community Member
*
Posts: 580


« on: February 02, 2010, 03:22:12 PM »

I'm working at getting the attach to bone sample to work in VB.NET Exprees 2008, and have had some problems.

1) Had an namespace error, which ended up being caused not by the name of the project, but by a variable for the (matrix or mouse?) "My As Long".  My is a Key word so its a no,no!  I changed the M to an N and the error went away. But I have a question about that to the extent that I don't know if the internal TV3D code requires the use of "My".  I've changed the other "My"'s in the rest of the project to reflect the use of Ny, but have other errors to resolve before I can get a working build to find out if the matrix or the mouse works!

Q) Does anyone know if using Ny in place of My will work?

   
2) I'm currently stuck on two errors

                'Here we set the object to the matrix we got in the previouse step !
                'Weapon(0).SetMatrix(Matrix(0))
                Weapon(0).SetMatrix(Matrix(0)) <-- (Matrix(0)) Structure 'MTV3D65.TV_3DMATRIX' cannot be indexed because it has no default property.
                Weapon(1).SetMatrix(Matrix(1)) <-- (Matrix(1)) Structure 'MTV3D65.TV_3DMATRIX' cannot be indexed because it has no default property.

Obviously I've missed something, but right now I haven't got a clue as to what I have missed.  Can anyone point me in the right direction?

Here's the code:(hope it fits)
Code:
Option Strict Off
Option Explicit On
' Import the MTV3D65 library.
Imports MTV3D65


Public Class frmMain

    Inherits System.Windows.Forms.Form
    ' ________________________________________________________________________
    ' TRUEVISION 6.5                        (web: http://www.truevision3d.com)
    ' ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
    ' Sample      : Attach To Bone
    ' ŻŻŻŻŻŻŻŻŻŻŻ
    ' Description : This sample demonstrates the ability to attach objects to your models etc.
    '               Here we attach the two Sword blades to this model !
    '               TrueVision3D Sample - By Arli Mujkic - Www.TrueVision3D.Com -
    '               Enjoy !
    '
    '               Tiny.x Model: 6000 + Polys !
    '               Sword.x Model: 700 + Polys !
    '
    '               NOTE:THE SWORD IS NOT TO BE REDISTRUBUTED IT BELONGS TO DOMINUS ONLINE,
    '               THANKS TO THE DOMINUS ONLINE TEAM FOR BORROWING US THE MODEL FOR THIS TUTORIAL !
    '               YOU CAN VISIT THEM AT WWW.DOMINUSONLINE.COM
    '
    '               Any Comments or suggestion, please e-mail us at: sample@truevision3d.com
    '
    '
    ' Force explicit declarations
    '
    '
    ' TV Variables.
    Public TV As TVEngine
    Public Scene As TVScene
    Public Inp As TVInputEngine
    Public Globals As TVGlobals
    Public Actor As TVActor
    Public Weapon(1) As TVMesh
    'Public Matrix(1) As D3DXMATRIX
    'Public Matrix(1) As TV_3DMATRIX
    Public Matrix As TV_3DMATRIX


    'Public Mx As Long, My As Long ' My is a key word bad thing!
    Public Mx As Long, Ny As Long
    Public AngleX As Single, AngleY As Single, AngleYz As Single, AngleXs As Single, AngleYs As Single, AngleZs As Single
    Public Mb1 As Integer, Mb2 As Integer, Mb3 As Integer

    Public bDoLoop As Boolean
    'Public finished As Boolean
    Public i As Integer
   

    Declare Function GetFocus Lib "user32" () As Integer


#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer. 
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.SuspendLayout()
        '
        'frmMain
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(632, 453)
        Me.Name = "frmMain"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "TV3D SDK 6.5 AttachToBone Sample"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ' Create the TV Interface first:
        TV = New TVEngine

        ' Set the debug file/options.
        ' Do this before the 3D init so it can log any errors found during init.
        TV.SetDebugMode(True, True)
        TV.SetDebugFile(System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\debugfile.txt")

        ' Set the search directory of the objects, textures, ...
        TV.SetSearchDirectory(System.IO.Path.GetDirectoryName(Application.ExecutablePath))

        ' After setting the beta-key/license its time to init the engine:
        TV.Init3DWindowed(Me.Handle, True)

        'Set Antialiasing Setting to 2 Samples.
        'To smooth out any jagged edges in the scene.
        TV.SetAntialiasing(True, CONST_TV_MULTISAMPLE_TYPE.TV_MULTISAMPLE_2_SAMPLES)

        ' Something good to do is to enable the auto-resize feature:
        ' Get the default viewport and set autoresize to true for it:
        TV.GetViewport.SetAutoResize(True)

        ' Lets display the FPS:
        TV.DisplayFPS(True)

        ' Set the prefered angle system:
        TV.SetAngleSystem(MTV3D65.CONST_TV_ANGLE.TV_ANGLE_DEGREE)

        ' Now after we are done initializing the TVEngine component lets continue:
        ' Create any other components after TV init.

        Scene = New TVScene
        Actor = New TVActor
        Globals = New TVGlobals
        Weapon(1) = New TVMesh
        'Matrix(1) = New D3DXMATRIX
        'Matrix(1) = New TV_3DMATRIX
        Matrix = New TV_3DMATRIX

        ' Input has an additional init method to call.
        Inp = New TVInputEngine
        ' Lets init both keyboard and mouse:
        Inp.Initialize(True, True)

        ' Now we have setup the most basic of components.
        ' Something to think about, if the component has a diffrent construct method
        ' then the Set Object = New TV<NAME>, use that one instead.

        ' For example:
        ' Dim Mesh as TVMesh;
        ' Mesh = Scene.CreateMeshBuilder "MyMesh" <- Instead of Set Mesh = new TVMesh
        ' Same goes for RenderSurface, Viewport etc.
        Actor = Scene.CreateActor("tiny")
        Actor.LoadXFile("..\..\tiny.x")
        Actor.SetName("tiny")
        Actor.SetAnimationID(0)
        'Actor.PlayAnimation(2000)
        Actor.PlayAnimation(0.2)
        Actor.SetMaterial(0)
        Actor.SetScale(0.08, 0.08, 0.08)
        Actor.SetRotation(-90, 130, 0)
        Actor.SetPosition(0, -25, -45)
        Actor.SetScale(0.1, 0.1, 0.1)

        ''Dim i As Integer
        'For Me.i = 0 To 1
        '    Weapon(Me.i) = Scene.CreateMeshBuilder("Weapon")
        '    Weapon(Me.i).LoadXFile("..\..\sword.x")
        '    Weapon(Me.i).SetMaterial(0)
        '    'Weapon(i).SetScale(2, 2, 2)
        '    Weapon(Me.i).SetScale(0.4, 0.4, 0.4)
        'Next Me.i

        Dim i As Integer
        For i = 0 To 1
            Weapon(i) = Scene.CreateMeshBuilder("Weapon")
            Weapon(Me.i).LoadXFile("..\..\sword.x")
            Weapon(i).SetMaterial(0)
            'Weapon(i).SetScale(2, 2, 2)
            Weapon(i).SetScale(0.4, 0.4, 0.4)
        Next i

        Scene.SetCamera(0, 0, -100, 0, 0, 0)

        'finished = False
        'RenderMain()
        ' Lets setup the Loop:
        bDoLoop = True       

        ' Display the Form
        Me.Show()
        Me.Focus()

        Do While bDoLoop
            ' Check if the application has focus, if yes thats when we process the loop.
            If GetFocus = Me.Handle.ToInt32 Then
                ' The actual render loop:
                TV.Clear(False)
                'Matrix = New TV_3DMATRIX
                'Here you get the boneMatrix where you attach your object on later in the code
                'Actor.GetBoneMatrix(boneid,vector,matrix);
                'Actor.GetBoneMatrix(31, Vector(0, 0, 0), Matrix(0))
                Actor.GetBoneMatrix(31)
                Globals.Vector(0, 0, 0)
                Actor.GetMatrix()
                'Actor.GetBoneMatrix(19, Vector(0, 0, 0), Matrix(1))
                Actor.GetBoneMatrix(19)
                Globals.Vector(0, 0, 0)
                Actor.GetMatrix()

                'Here we set the object to the matrix we got in the previouse step !
                'Weapon(0).SetMatrix(Matrix(0))
                Weapon(0).SetMatrix(Matrix(0))
                Weapon(1).SetMatrix(Matrix(1))

                'We rotate the weapon so its positions correctly
                Weapon(0).RotateY(-90)
                Weapon(1).RotateY(90)

                'Same thing here, and we move it so she holds it correctly
                'For Me.i = 0 To 1
                '    Weapon(Me.i).RotateZ(-40)
                '    Weapon(Me.i).MoveRelative(5, 7, 18)
                'Next Me.i

                For i = 0 To 1
                    Weapon(i).RotateZ(-40)
                    Weapon(i).MoveRelative(5, 7, 18)
                Next i


                'Rendering
                Actor.Render()

                'For Me.i = 0 To 1
                '    Weapon(Me.i).Render()
                'Next Me.i

                For i = 0 To 1
                    Weapon(Me.i).Render()
                Next i

                ' Render Everything
                Scene.RenderAll(True)
                TV.RenderToScreen()

                ' Lets check if the user presses ESC key, if yes we will quit the app.
                If Inp.IsKeyPressed(MTV3D65.CONST_TV_KEY.TV_KEY_ESCAPE) Then bDoLoop = False
            Else
                ' So we dont call DoEvents to many times if we arent using full CPU power.
                System.Threading.Thread.Sleep(100)
            End If

            ' Process any messages Windows has for the application, do this last:
            Application.DoEvents()

            Inp.GetMouseState(Mx, Ny, Mb1, Mb2, Mb3)

            If Mb1 <> 0 Then
                AngleX = AngleX - (Mx * TV.TimeElapsed / 5)
                AngleY = AngleY - (Ny * TV.TimeElapsed / 5)
            End If

            If Mb3 <> 0 Then
                AngleYz = AngleYz - (Ny * TV.TimeElapsed / 5)
            End If

            If Mb2 <> 0 Then
                AngleXs = AngleXs - (Mx * TV.TimeElapsed / 5)
                AngleYs = AngleYs - (Ny * TV.TimeElapsed / 5)
            End If

            If Inp.IsKeyPressed(CONST_TV_KEY.TV_KEY_LEFTSHIFT) And (Mb2 <> 0) Then
                AngleZs = AngleZs - (Ny * TV.TimeElapsed / 5)
            End If

            'Restrict the rotations
            If AngleX > 40 Then
                AngleX = 40
            End If
            If AngleX < -40 Then
                AngleX = -40
            End If
            If AngleY > 40 Then
                AngleY = 40
            End If
            If AngleY < -40 Then
                AngleY = -40
            End If
            If AngleYz > 40 Then
                AngleYz = 40
            End If
            If AngleYz < -40 Then
                AngleYz = -40
            End If

            If AngleXs > 40 Then
                AngleXs = 40
            End If
            If AngleXs < -40 Then
                AngleXs = -40
            End If
            If AngleYs > 40 Then
                AngleYs = 40
            End If
            If AngleYs < -40 Then
                AngleYs = -40
            End If
            If AngleZs > 40 Then
                AngleZs = 40
            End If
            If AngleZs < -40 Then
                AngleZs = -40
            End If

            'Apply the Angles
            Actor.SetBoneRotation(19, AngleXs, AngleYs, AngleZs, True)
            Actor.SetBoneRotation(9, AngleX, AngleY, AngleYz, True)

        Loop

        ' Additional Info:
        '
        ' Normally you dont have to keep track of the TV component and free it on closing.
        ' When you free the TV ATL Interface on close it will automatically clean all the internal
        ' objects aswell. Such as Mesh's, Textures etc.

        ' Though it might be good to know you do have the ability to destroy and nil objects
        ' for re-creation or cleanup during runtime if you want that.

        ' There are several methods for destroying and cleaning up objects.

        ' TV<NAME>.Destroy , DestroyAll exists for some objects aswell if it is a Factory of some sort.

        ' Some other good destroy methods are:
        ' TVScene.DestroyAllMeshs.
        ' TVTextureFactory.DeleteAllTextures.

        ' And others...


        ' Set TV to Nothing
        TV = Nothing

        ' End the application
        End

    End Sub

    Private Sub frmMain_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
        ' If we close the application stop the loop.
        bDoLoop = False
    End Sub
End Class
 

Picture of last working build...



« Last Edit: February 07, 2010, 03:21:28 PM by Dimple » Logged

Using VB.NET, TV3D 6.5, VISTA
~~~~~~~~~~~~~~~~~~~~~~~

"Know how to ask. There is nothing more difficult for some people, nor for others, easier."

- Baltasar Gracian
sciophyte
Customers
Community Member
*****
Posts: 245


« Reply #1 on: February 02, 2010, 05:56:23 PM »

1) yes it will still work, this looks like a variable representing MouseY (shortened to My) which is a keyword as you discovered.  the variable names can be anything, you might want to make it more descriptive of what it actually is though, MouseY or something would work.

2)you took out the matrix array declaration and replaced it with a single matrix structure it looks like you need 2 matrix variables (hence the Matrix(1)), but the main problem I think is where you call GetBoneMatrix, you aren't actually assigning the matrix variable the value

Actor.GetBoneMatrix(31)

should be

Matrix(n) = Actor.GetBoneMatrix(31)

it looks like the parameters to the function might have changed since this sample was written

don't forget to check the wiki documentation for the method paramters and return values.
Logged
Dimple
Community Member
*
Posts: 580


« Reply #2 on: February 03, 2010, 09:01:23 PM »

 Smiley

sciophyte

Thanks! It works! I used MouseX and Mousey, two separate matrix(0) and matrix(1) without the arrays which worked fine. I did find that I had to scale each of the swords separately.  I'll post the code and a picture of tiny with the swords.


Code:
Option Strict Off
Option Explicit On
' Import the MTV3D65 library.
Imports MTV3D65


Public Class frmMain

    Inherits System.Windows.Forms.Form
    ' ________________________________________________________________________
    ' TRUEVISION 6.5                        (web: http://www.truevision3d.com)
    ' ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
    ' Sample      : Attach To Bone
    ' ŻŻŻŻŻŻŻŻŻŻŻ
    ' Description : This sample demonstrates the ability to attach objects to your models etc.
    '               Here we attach the two Sword blades to this model !
    '               TrueVision3D Sample - By Arli Mujkic - Www.TrueVision3D.Com -
    '               Converted to Visual Basic 2008 Express By Dimple
    '               Enjoy !
    '
    '               Tiny.x Model: 6000 + Polys !
    '               Sword.x Model: 700 + Polys !
    '
    '               NOTE:THE SWORD IS NOT TO BE REDISTRUBUTED IT BELONGS TO DOMINUS ONLINE,
    '               THANKS TO THE DOMINUS ONLINE TEAM FOR BORROWING US THE MODEL FOR THIS TUTORIAL !
    '               YOU CAN VISIT THEM AT WWW.DOMINUSONLINE.COM
    '
    '               Any Comments or suggestion, please e-mail us at: sample@truevision3d.com
    '
    '
    ' Force explicit declarations
    '
    '
    ' TV Variables.
    Public TV As TVEngine
    Public Scene As TVScene
    Public Inp As TVInputEngine
    Public Globals As TVGlobals
    Public Actor As TVActor
    Public Weapon(1) As TVMesh
    Public Matrix(1) As TV_3DMATRIX

    Public bDoLoop As Boolean

    Declare Function GetFocus Lib "user32" () As Integer


#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer. 
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.SuspendLayout()
        '
        'frmMain
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(632, 453)
        Me.Name = "frmMain"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "TV3D SDK 6.5 AttachToBone Sample"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ' Create the TV Interface first:
        TV = New TVEngine

        ' Set the debug file/options.
        ' Do this before the 3D init so it can log any errors found during init.
        TV.SetDebugMode(True, True)
        TV.SetDebugFile(System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\debugfile.txt")

        ' Set the search directory of the objects, textures, ...
        TV.SetSearchDirectory(System.IO.Path.GetDirectoryName(Application.ExecutablePath))

        ' After setting the beta-key/license its time to init the engine:
        TV.Init3DWindowed(Me.Handle, True)

        'Set Antialiasing Setting to 2 Samples.
        'To smooth out any jagged edges in the scene.
        TV.SetAntialiasing(True, CONST_TV_MULTISAMPLE_TYPE.TV_MULTISAMPLE_2_SAMPLES)

        ' Something good to do is to enable the auto-resize feature:
        ' Get the default viewport and set autoresize to true for it:
        TV.GetViewport.SetAutoResize(True)

        ' Lets display the FPS:
        TV.DisplayFPS(True)

        ' Set the prefered angle system:
        TV.SetAngleSystem(MTV3D65.CONST_TV_ANGLE.TV_ANGLE_DEGREE)

        ' Now after we are done initializing the TVEngine component lets continue:
        ' Create any other components after TV init.

        Scene = New TVScene
        Actor = New TVActor
        Globals = New TVGlobals
        Weapon(1) = New TVMesh
        Matrix(1) = New TV_3DMATRIX

        ' Input has an additional init method to call.
        Inp = New TVInputEngine
        ' Lets init both keyboard and mouse:
        Inp.Initialize(True, True)

        ' Now we have setup the most basic of components.
        ' Something to think about, if the component has a diffrent construct method
        ' then the Set Object = New TV<NAME>, use that one instead.

        ' For example:
        ' Dim Mesh as TVMesh;
        ' Mesh = Scene.CreateMeshBuilder "MyMesh" <- Instead of Set Mesh = new TVMesh
        ' Same goes for RenderSurface, Viewport etc.

        ' Load Tiny
        Actor = Scene.CreateActor("tiny")
        Actor.LoadXFile("..\..\tiny.x")
        Actor.SetName("tiny")
        Actor.SetAnimationID(0)
        Actor.PlayAnimation(0.2)
        Actor.SetMaterial(0)
        Actor.SetScale(0.105, 0.105, 0.105)
        Actor.SetRotation(-90, 130, 0)
        Actor.SetPosition(0, -23, -45)

        ' Load the Weapons
        Dim i As Integer
        For i = 0 To 1
            Weapon(i) = Scene.CreateMeshBuilder("Weapon")
            Weapon(i).LoadXFile("..\..\sword.x")
            Weapon(i).SetMeshName("Weapon")
            Weapon(i).SetMaterial(0)
        Next i

        ' Camera position, Look at...
        Scene.SetCamera(0, 0, -100, 0, 0, 0)

        ' Lets setup the Loop:
        bDoLoop = True       

        ' Display the Form
        Me.Show()
        Me.Focus()

        Do While bDoLoop
            ' Check if the application has focus, if yes thats when we process the loop.
            If GetFocus = Me.Handle.ToInt32 Then

                ' The actual render loop:
                TV.Clear(False)

                'Here you get the boneMatrix where you attach your object on later in the code
                Matrix(0) = Actor.GetBoneMatrix(31)
                Globals.Vector(0, 0, 0)
                Actor.GetMatrix()
                Matrix(1) = Actor.GetBoneMatrix(19)
                Globals.Vector(0, 0, 0)
                Actor.GetMatrix()

                'Here we set the object to the matrix we got in the previouse step !
                Weapon(0).SetMatrix(Matrix(0))
                Weapon(1).SetMatrix(Matrix(1))

                'We rotate the weapon so its positions correctly,
                'and we move it so she holds it correctly.
                Weapon(0).RotateY(-90)
                Weapon(0).RotateZ(-42)
                Weapon(0).SetScale(0.2, 0.2, 0.2)
                Weapon(0).MoveRelative(-1, 0.1, 2)
                Weapon(1).RotateY(90)
                Weapon(1).RotateZ(-40)
                Weapon(1).SetScale(0.16, 0.16, 0.16)
                Weapon(1).MoveRelative(1, 0.12, 2)

                'Rendering
                Actor.Render()

                ' Render Everything
                Scene.RenderAll(True)
                TV.RenderToScreen()

                ' Lets check if the user presses ESC key, if yes we will quit the app.
                If Inp.IsKeyPressed(MTV3D65.CONST_TV_KEY.TV_KEY_ESCAPE) Then bDoLoop = False
            Else
                ' So we dont call DoEvents to many times if we arent using full CPU power.
                System.Threading.Thread.Sleep(100)
            End If

            ' We declare the mouse variables
            Dim Mousex As Long, Mousey As Long
            Dim AngleX As Single, AngleY As Single, AngleYz As Single, AngleXs As Single, AngleYs As Single, AngleZs As Single
            Dim Mb1 As Integer, Mb2 As Integer, Mb3 As Integer

            Inp.GetMouseState(Mousex, Mousey, Mb1, Mb2, Mb3)

            If Mb1 <> 0 Then
                AngleX = AngleX - (Mousex * TV.TimeElapsed / 5)
                AngleY = AngleY - (Mousey * TV.TimeElapsed / 5)
            End If

            If Mb3 <> 0 Then
                AngleYz = AngleYz - (Mousey * TV.TimeElapsed / 5)
            End If

            If Mb2 <> 0 Then
                AngleXs = AngleXs - (Mousex * TV.TimeElapsed / 5)
                AngleYs = AngleYs - (Mousey * TV.TimeElapsed / 5)
            End If

            If Inp.IsKeyPressed(CONST_TV_KEY.TV_KEY_LEFTSHIFT) And (Mb2 <> 0) Then
                AngleZs = AngleZs - (Mousey * TV.TimeElapsed / 5)
            End If

            'Restrict the rotations
            If AngleX > 40 Then
                AngleX = 40
            End If
            If AngleX < -40 Then
                AngleX = -40
            End If
            If AngleY > 40 Then
                AngleY = 40
            End If
            If AngleY < -40 Then
                AngleY = -40
            End If
            If AngleYz > 40 Then
                AngleYz = 40
            End If
            If AngleYz < -40 Then
                AngleYz = -40
            End If

            If AngleXs > 40 Then
                AngleXs = 40
            End If
            If AngleXs < -40 Then
                AngleXs = -40
            End If
            If AngleYs > 40 Then
                AngleYs = 40
            End If
            If AngleYs < -40 Then
                AngleYs = -40
            End If
            If AngleZs > 40 Then
                AngleZs = 40
            End If
            If AngleZs < -40 Then
                AngleZs = -40
            End If

            'Apply the Angles
            Actor.SetBoneRotation(19, AngleXs, AngleYs, AngleZs, True)
            Actor.SetBoneRotation(9, AngleX, AngleY, AngleYz, True)

            ' Process any messages Windows has for the application, do this last:
            Application.DoEvents()

        Loop

        ' Additional Info:
        '
        ' Normally you dont have to keep track of the TV component and free it on closing.
        ' When you free the TV ATL Interface on close it will automatically clean all the internal
        ' objects aswell. Such as Mesh's, Textures etc.

        ' Though it might be good to know you do have the ability to destroy and nil objects
        ' for re-creation or cleanup during runtime if you want that.

        ' There are several methods for destroying and cleaning up objects.

        ' TV<NAME>.Destroy , DestroyAll exists for some objects aswell if it is a Factory of some sort.

        ' Some other good destroy methods are:
        ' TVScene.DestroyAllMeshs.
        ' TVTextureFactory.DeleteAllTextures.
        ' And others...


        ' Set Scene to Nothing
        Scene = Nothing

        ' Set Actor to Nothing
        Actor = Nothing

        ' Set Globals to Nothing
        Globals = Nothing

        ' Set Weapon(0) to Nothing
        Weapon(0) = Nothing

        ' Set Weapon(1) to Nothing
        Weapon(1) = Nothing

        ' Set Matrix(1) to Nothing
        Matrix(1) = Nothing

        ' Set Inp to Nothing
        Inp = Nothing

        ' Set TV to Nothing
        TV = Nothing

        ' End the application
        End

    End Sub

    Private Sub frmMain_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
        ' If we close the application stop the loop.
        bDoLoop = False
    End Sub
End Class


Proof is in the picture...

Logged

Using VB.NET, TV3D 6.5, VISTA
~~~~~~~~~~~~~~~~~~~~~~~

"Know how to ask. There is nothing more difficult for some people, nor for others, easier."

- Baltasar Gracian
martinw
Community Member
*
Posts: 43


« Reply #3 on: September 16, 2010, 10:27:41 AM »

I don't know whether it's the same thing but I attached a camera to a bone and as the actor moved around it jiggled around, also I attached a light to a bone and it flashed on and off as the actor moved.

Since then I've attached the camera and light manually with set and get position and they work fine ......  Huh

You can see the light flashing (in the video below) as the ROV (the object with the propellers turning) in the middle of it moves towards you initially. All it is, is a spotlight, nothing fancy to make it flash honest Smiley

http://www.youtube.com/watch?v=vLui2XgHK4E
« Last Edit: September 16, 2010, 10:37:43 AM by martinw » Logged
Dimple
Community Member
*
Posts: 580


« Reply #4 on: September 16, 2010, 08:28:02 PM »

 Smiley

The only thing I see blinking appears to be the text name above the Mech, can you either put it a little higher up or try the scene with out it, and see if that's what you are seeing?  Other wise try what martinw suggested and keep up the good work I like what I've seen so far.
Logged

Using VB.NET, TV3D 6.5, VISTA
~~~~~~~~~~~~~~~~~~~~~~~

"Know how to ask. There is nothing more difficult for some people, nor for others, easier."

- Baltasar Gracian
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks