Worm muscle contraction simulation(involved many individual muscle pieces)

I am trying to simulate a worm called c elegans, it has many muscle groups on the body. I want to be able to contract each muscle piece independently with script, what would be the best way to do this? Thank you

To begin with, are you totally familiar with "boned/skinned models" and their place in video game engineering? that would be a basic starting point. you are asking a very advanced question. If you have not reached that level, pls delete the question and enjoy the next yr or two of research! :)

Using springs from the physics system sounds obvious, but probably isn't good enough for this. Springs can be set to "want" to be a certain distance apart (like a resting muscle length,) but generally each object (chunk of worm?) gets only 1 attachment. So no good way to simulate, say, a ring of 6 lengthwise muscles, all acting on segments. Plus the system tends to get jittery when lots of things are all affecting each other. If you find code for a high-powered yet slow physics simulator, could run it in Unity (even C++ though a DLL, I think) and just use Unity for display.

I think using springs from the physics system is a good idea, I can certainly give that a try, but I was wondering if there are any built-in functions in unity that does non-bipedal mechanism. I understand there is one in unity that simulates human skeletons, could I possibly tweak the system to make what I wanna do? or do you guys know of any video tutorial that teaches this mechanisms, thank you!

Well there's your answer ... http://answers.unity3d.com/questions/437115/in-a-bonedskinned-model-can-you-shrink-a-bone.html of course, you CAN easily shorten a bone. So, that's perfect. (There isn't really "bones" it's just the distance between two "joints" in a skinned model.) So, you have to get to work learning to use Cheetah3D, Maya or the like to make "boned" models, and then Unity. Good luck!

1 Answer

1

Not really an answer, but too long to fit into comments:

“Skeleton” animation (technical term: bones) usually starts with a human-created set of movements on a stickman. Either by an artist, of motion capture. So any muscle action is never computed – either faked (artist) or observed (mo-cap.)

The bipedal skeleton system is then about playback, or synching forward motion with foot motion (avoid moonwalking.) It generally assumes you have a pre-done set of motions.

Say you had a “boned” worm, (no animation needed.) It would be a little like a radio-controlled set of connected motorized rods, wrapped in wormed-shaped clay. If you did all the math yourself, you could use the bones to internally bend the worm in the correct way. So, instead of maybe having a set of spheres for the body, which would “bend,” by moving spheres, you could have a continuous body which would flex.

"Say you had a "boned" worm, It would be a little like a radio-controlled set of connected motorized rods" That is a fantastic analogy, man.

Exactly what Owen said. I just realized, we were WORKING ON a project like this !! [9996-wormlike.jpg|9996] This "thing" .. it's like a tongue or flattened worm or flattened sausage .. moves beautifully in 3D. You see? This is exactly how you do it. The first comment anyone gave you ages ago was "are you familiar with boned/skinned models" one issue though, Owen .. I actually don't know, can you "contract" a bone in some way ??? and have the skin shrink as you do so? Does anyone know this ?

If you drag in any boned model, you can see that the bones are represented as transforms, and scaling them deforms the model in the way you would expect. So, yes, you can scale bones. Animation software can save rotation, position, scale; but I think most animators are taught never to use scale (since you can't shrink a real bone.)

indeed, you're utterly correct of course Owen. it's funny it just "didn't occur to me" - as you say one is so used to animations where bones are fixed! there's a line of code for the OP even! http://answers.unity3d.com/questions/437115/in-a-bonedskinned-model-can-you-shrink-a-bone.html it would be great to get at the skinning and write "bulging" as a concept in to the skinning

The best way to do this would be using a model with "morphs" on it from 3DS/etc or to do a similar kind of thing - modifying the vertices and retaining the volume of the muscle.