"Snapping" bones to meshes

Blitz3D Forums/Blitz3D Programming/"Snapping" bones to meshes

xtremegamr(Posted 2007) [#1]
The topic says it all: Can I snap bones to meshes and animate them?


jhocking(Posted 2007) [#2]
No the topic doesn't say it all. What the heck does "snapping" mean?


xtremegamr(Posted 2007) [#3]
By "snapping", I meant attaching.


Matty(Posted 2007) [#4]
You can attach blitz entities to bones by using the entityparent command.


jhocking(Posted 2007) [#5]
*sigh* And what do you mean by "attaching"? Do you want to rigidly have a bone moving along with a whole object? Do you want to link vertices to bones as per soft-skin skeletal animation?

Also, what is the antecedent for "them" in your original question? That is, are you wanting to animate the mesh and have the bone move with it, or the other way around?

Just generally, your question is vague and you need to be specific and fully explain the situation you are asking about.


Dreamora(Posted 2007) [#6]
You can not create bones in realtime and use them.
Especially you can not assign vertices to bones in realtime.

Those informations can only be loaded from a B3D

But you can indeed import a model that is rigged for a specific bone skeleton and import a bone skeleton with the same naming etc and then entity parent the model to that skeleton to use its animation.
You can as well manually rotate the bones on the model if you want to animate it


xtremegamr(Posted 2007) [#7]
I'm making an FPS. I want to have rag doll physics for the enemies, so I want to know if I can make the animations (with bones only), then somehow attach the individual body parts to that bone-animation.


Gabriel(Posted 2007) [#8]
And Dreamora already answered that when he said

Especially you can not assign vertices to bones in realtime.


What you suggest, however, makes no sense to me. You seem to be trying to do precisely the opposite of what I would be doing if I wanted rag doll physics. Perhaps it's just me, but I'd be wanting to attach my vertices to bones in the modeller and then control the bone positions in code. Which you can do. But for whatever reason, that doesn't seem to be your aim.


jhocking(Posted 2007) [#9]
I'm making an FPS. I want to have rag doll physics for the enemies, so I want to know if I can make the animations (with bones only), then somehow attach the individual body parts to that bone-animation.

Ah okay, that clarification helps a lot. As Gabriel says however you are thinking of it kind of backward. Rather than attaching the body parts in code, everything should be setup in your animation tool for skeletal animation and then when you move bones in code the body parts will move with them. Name the bones before export and use those names to FindChild (or is it GetChild? I get those commands mixed up) the bones in code.

It is important to remember though that any animation in the skeleton will override moving bones in code. In general when moving bones in code, you want to make sure calls to PositionEntity or whatever are happening after UpdateWorld; for physics simulation specifically however you will want to turn off animations entirely using the Animate command with the off parameter.


t3K|Mac(Posted 2007) [#10]
i'd create the bones in the modeller. then assign several physic boxes to the bones (which are assigned to vertices) and let a physics engine do the rest. i am also currently developing ragdoll for my fps and i go this way.


xtremegamr(Posted 2007) [#11]
Cool...but how can I get my hands on a physics engine?


jhocking(Posted 2007) [#12]
Wait, you're asking about applying ragdoll physics to a skeletal animated character when you haven't even gotten a physics engine working? Dude, walk before you can run.


Leon Drake(Posted 2007) [#13]
if its any help i wrote a snap to bone code in the code archives, but its mainlt for using seperate meshes as body parts

http://www.blitzbasic.com/codearcs/codearcs.php?code=1917


t3K|Mac(Posted 2007) [#14]
one note: if you want to apply a physics based ragdoll effect on animated models, you have to animate the models "by hand" - using setanimtime. "animate model,1" is a no go, because you cannot stop an animation at a current frame. when you stop it, the model will be positioned back to the beginning animation frame. using setanimtime, you can always stop the animation where you want to and then apply ragdoll. looks better. feels better ;)