Pick Animated .b3d

BlitzMax Forums/MiniB3D Module/Pick Animated .b3d

BLaBZ(Posted 2012) [#1]
How do you pick an animated .b3d mesh?

I was able to pick before I animated but now I can't


BLaBZ(Posted 2012) [#2]
It can pick properly from frame 1-60 but not 60-700


AdamRedwoods(Posted 2012) [#3]
you may not be able to, as the pick mechanism will use triangles from the original mesh only.

one way around this is to take a bone and assign a sphere (or box) collision radius to it. This would allow a spherical pick / collisions. This is how it's done in most games, too, by using a simplified mesh.


BLaBZ(Posted 2012) [#4]
Great idea! How do I get the bones?


BLaBZ(Posted 2012) [#5]
This was my attempt but it seems the animation doesn't have any bones?!


Function BonePick(Entity:TEntity)

	For Local x:Int = 0 To TMesh(Entity).no_bones-1
		EntityPickMode(TMesh(Entity).Bones[x],1)
		EntityRadius(TMesh(Entity).Bones[x],10)
	Next

End Function



Yasha(Posted 2012) [#6]
The bones are just the pivot-entities that are the base mesh's children. Your standard FindChild/GetChild/CountChildren commands will work for this. The best way is to plan this while in the animation editor and give each bone a name that will let you identify it easily, and have all the animated characters of the same type in your game have the same naming convention for their various bones (e.g. humanoids all have a UArmRight, LArmRight, UArmLeft, LArmLeft etc.).

EDIT: eh, ninja'd. Yeah doing it directly is a better way than sticking to the old command set.

Last edited 2012


Kryzon(Posted 2012) [#7]
They are children of the mesh they deform.

You can get their entity handles with the FindChild() function.

EDIT: double-ninja'd by Yasha... will it come to an end?!

Last edited 2012


BLaBZ(Posted 2012) [#8]
Got it! Just a little recursion

Function BonePick(Entity:TEntity)

	For Local bone:TBone = EachIn Entity.Child_List
		EntityPickMode(bone,1)
		EntityRadius(bone,4)
		BonePick(bone)
	Next

End Function