0
$\begingroup$

I cant get the mesh to not wig out after it falls.

I'm guessing I need the bones to fall with the mesh so the mesh deforms relative to the bones. I can't figure out how to do this and nothing I've googled has helped.

Any help would be greatly appreciated!

enter image description here

$\endgroup$
1
$\begingroup$

You can't. Armature are not supported in context with the rigid body sytem. The behaviour occurs, since the Armature is evaluated after the rigid body simulation. You can't change the order of evaluation (as in Maya e.g.).

Shapekey however, get evaluated before rigid bodies.

Use this hacky script to transfer your animation into shapekeys. (Refine it first, then use it!)
To make this script work, the active object:

  • has to be selected
  • has to have an Armature modifier name "Armature"
  • has to have no Armature modifier name "Armature.001"
  • has to have a "Basis" Shapekey

import bpy

scn = bpy.context.scene

frame_range = [1, 200]
for i in range(frame_range[0], frame_range[1] + 1):
    scn.frame_set(i)
    bpy.ops.object.modifier_copy(modifier="Armature")
    bpy.ops.object.modifier_apply(apply_as='SHAPE', modifier='Armature.001')
    bpy.data.shape_keys["Key"].key_blocks["Armature.001"].name = str(i).zfill(3)


key = bpy.context.selected_objects[0].data.shape_keys.key_blocks


for i in range(frame_range[0], frame_range[1] + 1):
    key[str(i).zfill(3)].value = 0
    key[str(i).zfill(3)].keyframe_insert(data_path="value", frame=(i+1))
    key[str(i).zfill(3)].keyframe_insert(data_path="value", frame=(i-1))
    key[str(i).zfill(3)].value = 1
    key[str(i).zfill(3)].keyframe_insert(data_path="value", frame=i)

  1. Disable the rigid body, by checking its animated property.
  2. Create the Basis Shapekey.
  3. Execute the script.
  4. Hide the Armature modifier.

enter image description here

The animation is now transfered to shapekeys.

Disable the animated property again to simulate.

If you wish to change the animation, delete all shapekeys and enable the armature modifier again.

$\endgroup$
  • $\begingroup$ looks like I'm getting a syntax error after running your script. Any thoughts? screenshot $\endgroup$ – David Skillin May 5 '18 at 5:39
  • $\begingroup$ @DavidSkillin The code had some incorrect linebreak due to a markdown error. It now has correct line breaks and indentation. $\endgroup$ – Leander May 5 '18 at 9:28
  • $\begingroup$ You wrote Animation modifier. Did you intend to write Armature modifier? $\endgroup$ – atomicbezierslinger Jul 13 '18 at 14:29
  • $\begingroup$ @atomic Most definitely, thank you for notifiying me. $\endgroup$ – Leander Jul 13 '18 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.