sword?

Blitz3D Forums/Blitz3D Beginners Area/sword?

Terry B.(Posted 2006) [#1]
So lets say I have an animated 3d person, who draws a sword.

Do I have to accually put the sword into the b3d and animate it with it? Or can I just assign it to be a child of the hand so it moves with the hand?

And if I do have to animate it, is there any way to make it so that the sword has a particular collision radius\box?


b32(Posted 2006) [#2]
I think you can assign it to the hand bone. Use CountChildren/GetChild or FindChild for that.


Terry B.(Posted 2006) [#3]
Thanks, but how do I accually know the handle of the hand bone?


b32(Posted 2006) [#4]
To find the names all children in a mesh, use this:
Graphics3D 800, 600, 0, 2
PrintOutName(LoadAnimMesh("c:\_xfiles\mak_robotic.x"))
WaitKey()
End


Global c
Function PrintOutName(mesh, id = 0)
	Print String$("   ", id) + EntityName$(mesh) + "<"
	c = c + 1
	If c = 20 Then 
		c = 0
		Print "Press any key"
		FlushKeys()
		WaitKey()
		FlushKeys()
	End If
	For i = 1 To CountChildren(mesh)
		PrintOutName(GetChild(mesh, i), id + 1)
	Next
End Function

After finding out the name of the bone, use "bone = FindChild(mesh, name$)" (or "bone = GetChild(mesh, index)" if you know the index) to get a handle without using this routine. Then use "Entityparent sword, bone" and maybe PositionEntity sword, 0, 0, 0