You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.
I have discovered a bit of a flipping problem with the leg_3jnt_01 component.
The leg component has joints ranging from leg_L0_0_jnt through to leg_L0_9_jnt followed by leg_L0_end_jnt.
The flipping occurs when rotating leg_L0_ik_ctl in positive X. 91.068 is the exact number where the flip occurs (the guide is kept in default arrangement for the test).
At 91.068 rotation X on the IK control leg_L0_9_jnt and leg_L0_end_jnt flips from zero to -180. When skinning to these joints it becomes quite obvious when the flipping occurs.
My use case is a cat leg and the IK controller get rotated to curl the paw while walking for example.
This problem can perhaps be fixed if the way the foot connects to the leg is setup in a way that it has a control that when rotated only affects the foot but when translated affects both ik effector and foot.
import pymel.core as pm
from mgear.core.transform import getChainTransform2
# Pick joint chains
jnts = [pm.PyNode("jnt" + str(i)) for i in range(4)]
helperJnts = [pm.PyNode("helperJnt" + str(i)) for i in range(3)]
# Read world space xforms and positions
jnt_xform = [j.getMatrix(ws=1) for j in jnts]
Jn = [j.translate for j in jnt_xform]
L = sum([(Jn[i + 1] - Jn[i]).length() for i in range(3)])
# Compute ja and Jfull
ja = (Jn[1] - Jn[0])
ja.normalize()
Jfull = Jn[3] - Jn[0]
# Main formula
A = (Jfull * Jfull - L * L) / (2 * (ja * Jfull - L))
# Construct helper joint chain
hj1_pos = [Jn[0], Jn[0] + ja * A, Jn[3]]
hj1_norm = pm.dt.cross(Jn[1] - Jn[0], Jn[2] - Jn[1])
hj_xform = getChainTransform2(hj1_pos, hj1_norm)
helperJnts[0].setMatrix(hj_xform[0], ws=1)
helperJnts[1].setMatrix(hj_xform[1], ws=1)
helperJnts[2].setMatrix(hj_xform[2], ws=1)
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
From @Lohult on August 5, 2018 12:42
Hi Miquel,
I have discovered a bit of a flipping problem with the leg_3jnt_01 component.
The leg component has joints ranging from leg_L0_0_jnt through to leg_L0_9_jnt followed by leg_L0_end_jnt.
The flipping occurs when rotating leg_L0_ik_ctl in positive X. 91.068 is the exact number where the flip occurs (the guide is kept in default arrangement for the test).
At 91.068 rotation X on the IK control leg_L0_9_jnt and leg_L0_end_jnt flips from zero to -180. When skinning to these joints it becomes quite obvious when the flipping occurs.
My use case is a cat leg and the IK controller get rotated to curl the paw while walking for example.
Copied from original issue: mgear-dev/mgear_legacy#236
The text was updated successfully, but these errors were encountered: