Need help with function...

Blitz3D Forums/Blitz3D Programming/Need help with function...

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Assume you have checked that MeshToAttach has a value > 0?

Also, make sure you compare child to otherchildren to ensure that you're not parenting a child to itself .. I think will cause issues.

Function AttachMesh(MeshToAttach,Mesh)
	
	For Children = 1 To CountChildren(MeshToAttach)
		Child = GetChild(MeshToAttach,Children)
		For OtherChildren = 1 To CountChildren(Mesh)
			OtherChild = GetChild(Mesh,OtherChildren)
			If Child <> OtherChild
				If EntityName(Child) = EntityName(OtherChild) 
					EntityParent(Child,OtherChild)
					Exit
				EndIf
			EndIf
		Next
	Next
	
End Function