[Modular Rig][5.8.4] Leg module detecting wrong side foot

Summary

In a Modular Rig, when dropping a leg module on one of the procedurally created leg sockets the foot socket then appears on the wrong side.

What Type of Bug are you experiencing?

Animation

Steps to Reproduce

  1. Create a modular rig for any skeletal mesh character (issue happens with Metahuman or non-Metahuman humanoid characters)
  2. Drop the spine module on the corresponding automatic socket
  3. Drop a leg module on the left leg socket

Expected Result

The foot socket appears on the same leg where the leg module was added.

Observed Result

The foot bones and controllers are swapped between left and right leg resulting in deformed animation when the control rig is used in a sequence.

Affects Versions

5.8

Platform(s)

Windows

Upload an image

This bug is still present in the recently released 5.8.4 release. This bug has rendered biped modular rigging creation basically no-functional. This is a feature important for my teaching so I hope it can be fixed soon.

And this is Claude’s assessment of the issue:

What’s wrong

The Leg module creates the socket that the Foot module attaches to, inside ConstructionGraph → Spawn Socket. When the skeleton has toe metadata, it decides where the socket goes like this:

  1. It guesses the leg’s side by running Get Side from Metadata on the Leg Primary bone.
  2. It picks Toe R if the guess is “right”, otherwise Toe L.
  3. It adds the socket under that toe.

In 5.6 there was a safety check between steps 2 and 3, and 5.8 removed it. The 5.6 version also:

  • got every bone under the leg (ResolveConnector_4 on Leg Primary → CollectionChildrenArray_2_1, recursive, including the parent);
  • checked that the chosen toe is actually in that list (Find_2);
  • only added the socket if it was (RigVMFunction_ControlFlowBranch_3).

In 5.8, the side check now leads straight to the “add socket” step. The diff against 5.6 shows only those four removed nodes and the rewired connections; nothing else in the Leg changed. The Foot module matched 5.6 on every pin.

Why the socket ends up on the wrong side

Without the check, the socket’s placement depends entirely on the side guess. Get Side from Metadata decides by multiplying the bone’s position by the rig’s Mirror Axis metadata. If that metadata isn’t set, its default is (0,0,0), so the result is always “not right” and both legs pick Toe L. The right leg’s foot socket then appears on the left toe. A skeleton whose left/right axis sign doesn’t match the convention fails the same way. In 5.6, the check would catch the wrong toe (it isn’t under this leg) and skip it.

I found this by reading and comparing the graphs.

It seems Claude was able to fix it, at least what I’ve tested so far. In the process of fixing it, additional bugs were identified, including one that caused the feet of the character to get mangled when the control rig was used as additive. This is Claude’s bug report:

UE 5.8 ControlRigModules: Leg and Foot module bugs

Engine: Unreal Engine 5.8 (Epic Launcher build, install verified)
Plugin: ControlRigModules
Assets: /ControlRigModules/Modules58/Leg, /ControlRigModules/Modules58/Foot
Reproduced on: custom biped skeleton, Mixamo human skeleton


  1. [High] Feet are mangled when the modular rig is used as a Layered control rig in Sequencer

Steps:

  1. Build a Modular Control Rig with Root, Spine, Leg and Foot modules on a biped.
  2. Add the character to a Level Sequence with an animation, then add the control rig.
  3. Convert the control rig track to Layered.

Result: Both feet are twisted on every frame, with no keys set. The animation is correct without the rig, and the Control Rig editor’s Backwards and Forwards preview with the same animation looks correct. Removing the Foot modules makes the problem go away.

Cause: In the additive path of UControlRig::Evaluate_AnyThread (ControlRig.cpp), each evaluation resets every control to its initial local transform and switches it back to its default parent. Nulls get their local transform reset too, but are not switched back to their default parent. The Foot module’s Backwards Solve runs SwitchParent on Effector Null (the Leg’s foot_*_ik_effector null) with Parent Foot Control and Maintain Global on. From the second evaluation on, the null is still parented to Foot Control, so its reset local transform is applied in the wrong space. Maintain Global then keeps that wrong position, and the leg IK solves to it.

Workaround applied: In a copy of Foot’s Backwards Solve, before the existing SwitchParent: SwitchParent (Mode DefaultParent, Maintain Global off) on Effector Null, then SetTransform (Local, current) with the value from GetTransform (Local, initial) of the same null. This fixed the feet in Layered mode.

Suggested engine fix: in the additive reset, also switch nulls back to their default parent, matching how controls are handled.


  1. [Medium] The Foot module’s Foot Bone connector always resolves to foot_l

Steps:

  1. Place a Foot module on each leg’s foot socket.
  2. Check the right Foot’s Foot Bone connection.

Result: The right Foot resolves Foot Bone to foot_l. The left Foot is correct only by coincidence.

Cause: In Foot’s Connector Event graph, the If node that supplies the metadata name to Connect to Module Metadata for the Foot Bone connector (True “foot_r”, False “foot_l”) has nothing wired into Condition, so it always picks foot_l. The Is Right Side v2 node in the same graph runs, but its Right Side output is unconnected. The same wiring exists in Modules56/Foot.

Workaround applied: Connect Is Right Side v2.Right Side to If.Condition.


  1. [Medium, regression in 5.8] The Leg module puts the foot socket on the opposite leg

Steps:

  1. Use a skeleton whose toe bones are published by Root as toe_l and toe_r metadata (for example ball_l and ball_r).
  2. Drop a Leg module on each thigh socket.

Result: Each leg creates its foot socket under the other leg’s toe bone. Observed on a skeleton with thigh_l at X = +31 and thigh_r at X = -31 (global), with Root’s Left Axis at its default (1,0,0).

Cause:

  • Removed check (5.8 regression): In Modules56/Leg, Spawn Socket only added the toe socket after confirming the chosen toe is a descendant of Leg Primary (Get Children recursive → Find → Branch). In Modules58/Leg those four nodes are gone and the branch goes straight to Spawn Socket. This was the only difference between the two Leg assets.
  • Side test: Get Side from Metadata multiplies the position by Mirror Axis, then inverts the result when the axis is negative. The two cancel, so the result does not depend on the axis sign. It reports the positive side of Root’s Left Axis as right, and If picks Toe R when true. Foot’s Is Right Side v2 treats the same axis the opposite way.

Workaround applied: Restored the 5.6 descendant check, and replaced the side test for the toe choice with Find(Toe R in Leg Primary’s recursive children).Success driving If.Condition. Each leg now picks the toe that is actually under it, regardless of skeleton orientation.

Note: The side-test cause was traced from the graph logic on one custom skeleton. It has not been checked against the UE5 Manny.