Hi,
i have converted quite a lot of code to vb.net, all seems to work fine, but i am having an issue with one function, been scratching my head for a while i am sure it is a simple thing but i dont know what here is the function:
the error i get no matter which file i try is:
line that errors: Dim assimpBone = AssimpMesh.Bones(boneIndex)
Exception Thrown
system.NullReferenceException: 'Object reference not set to an instance of object
Ab3d.Assimp.Skeleton.AssimpMesh.get returned Nothing.
can anyone help please
i have converted quite a lot of code to vb.net, all seems to work fine, but i am having an issue with one function, been scratching my head for a while i am sure it is a simple thing but i dont know what here is the function:
Code:
Private Function GenerateSkeleton(ByVal node As Node, ByVal parentSkeletonNode As SkeletonNode, ByRef boneNodesLeftToGenerate As Integer) As SkeletonNode
If node Is Nothing Then Return Nothing
Dim newlyCreatedSkeletonNode As SkeletonNode
Dim boneIndex = Array.IndexOf(_allBoneNames, node.Name)
If boneIndex >= 0 Then
Dim assimpBone = AssimpMesh.Bones(boneIndex)
boneNodesLeftToGenerate -= 1
newlyCreatedSkeletonNode = New SkeletonNode(node, assimpBone, parentSkeletonNode, boneIndex:=SkeletonNodes.Count)
Else
newlyCreatedSkeletonNode = New SkeletonNode(node, Nothing, parentSkeletonNode, -1)
End If
SkeletonNodes.Add(newlyCreatedSkeletonNode)
If node.HasChildren AndAlso boneNodesLeftToGenerate > 0 Then
For i = 0 To node.ChildCount - 1
Dim childBone = GenerateSkeleton(node.Children(i), newlyCreatedSkeletonNode, boneNodesLeftToGenerate)
If childBone IsNot Nothing Then newlyCreatedSkeletonNode.Children.Add(childBone)
Next
End If
Return newlyCreatedSkeletonNode
End Function
line that errors: Dim assimpBone = AssimpMesh.Bones(boneIndex)
Exception Thrown
system.NullReferenceException: 'Object reference not set to an instance of object
Ab3d.Assimp.Skeleton.AssimpMesh.get returned Nothing.
can anyone help please
Kevan Hampson