Transfer Physics from one Character to Another

Hi all,

Here’s a quickie demonstrating how to assign physics to one of many characters with identical controls and hierarchy. We’ll utilise Export Physics and Import Physics for this!

  1. Assign
  2. Export
  3. Import

Assign

Step one, let’s assign some physics. I won’t tweak any of the defaults here, but if you did then any tweaks would come along for the ride as well.

Export

Once we’re happy, let’s export.

Import

Importing this file as-is would try and apply it back onto the same character you’ve already got setup. So instead, we’ll pick the namespace of one of the other characters and import into that instead. We do the same for the other namespace.

Tweaks

In this particular example, I assigned to the FK controls but imported onto a character with IK enabled. It’ll import onto the FK controls you assigned, so you can either switch back to FK like I did here, or assign directly to the underlying joints driven by IK and retarget the controls to either FK, IK or both.

See here for a tutorial on IK and retargeting.

1 Like

Hi Marcus,

I’m having some trouble trying to reproduce this method in Maya. The thing is that I have a variant of my character to which I want to attach the ragdoll rig, but when I bring it to the scene, the elements are disconnected. The script editor gives me the following error:

// ragdoll._create_solvers() - Creating solver(s)… //
// ragdoll._create_groups() - Creating group(s)… //
// ragdoll._create_markers() - Creating marker(s)… //
// Warning: ragdoll._import_physics_wrapper() - Traceback (most recent call last):
File “C:\Users\amonreal\Documents\maya\modules\Ragdoll-2022_07_20\scripts\ragdoll\interactive.py”, line 3604, in _import_physics_wrapper
_singleton_import_loader.reinterpret()
File “C:\Users\amonreal\Documents\maya\modules\Ragdoll-2022_07_20\scripts\ragdoll\internal.py”, line 441, in _undo_chunk
return func(*args, **kwargs)
File “C:\Users\amonreal\Documents\maya\modules\Ragdoll-2022_07_20\scripts\ragdoll\dump.py”, line 450, in reinterpret
rdmarkers = self._create_markers(rdgroups, rdsolvers)
File “C:\Users\amonreal\Documents\maya\modules\Ragdoll-2022_07_20\scripts\ragdoll\dump.py”, line 665, in _create_markers
self._apply_marker(mod, entity, rdmarker)
File “C:\Users\amonreal\Documents\maya\modules\Ragdoll-2022_07_20\scripts\ragdoll\dump.py”, line 1272, in _apply_marker
mobj = meshes_to_mobj(Meshes)
File “C:\Users\amonreal\Documents\maya\modules\Ragdoll-2022_07_20\scripts\ragdoll\dump.py”, line 1299, in meshes_to_mobj
for index in range(len(polygon_connects) / 3):
TypeError: ‘float’ object cannot be interpreted as an integer
//
// Warning: ragdoll._import_physics_wrapper() - An unexpected error occurred, see Script Editor //

Could you tell me what I’m doing wrong? Basically what I do is export the system and bring it into another scene with the same character rig.

My Maya versión is: Maya 2022,4
And ragdoll versión is: 2022.07.20

Thank you very much.

Hi @AlexM, you’ve spotted a bug. This applies to Maya 2022 and 2023, and will be fixed in the next release.

Until then, there is something a bit hacky you can do, it’s a somewhat simple fix.

for index in range(len(polygon_connects) / 3):

This line should instead be:

for index in range(len(polygon_connects) // 3):

Notice the double //. It has to do with the update to Python 3 in Maya 2022 and above.

If you go to that file in the error message, and edit this (line 1299), then you can restart Maya and it should work again.

C:\Users\amonreal\Documents\maya\modules\Ragdoll-2022_07_20\scripts\ragdoll\dump.py

Hi @Marcus,

Thanks for the explanation and the quick response. Let’s do what you tell us and see what happens. On the other hand, we have also realized that the meshes in the default meshes of the markers are lost and the program interprets them in a wrong way or giving it another shape or creating capsules or spheres. Is it an error similar to the previous one or would it be necessary to regenerate them one by one?

I expect this is related. Once Ragdoll encounters that error, it would stop importing the file and leave things as spheres and other erroneous things. Give it a try and let me know if this still happens with the above “hotfix”.

Also, if you can, try this exact thing in Maya 2018, 2019 or 2020 to see what should happen. The problem is exclusive to Python 3-enabled versions of Maya.

Ok, thanks. As soon as I check it, I’ll let you know.

Hi again @marcus. it works perfectly.

Thanks!!!

1 Like