Message 1 of 1
Seamless ik/fk problem
Not applicable
06-22-2009
07:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey everyone.
I have this script I'm working on that allows to seamlessly go from IK to FK on a bone chain. I have an IK chain of bones and a FK chain. The IK chain should be the one skinned on the mesh. Whe you animate either the IK or FK chain, the other chain is supposed to update itself as you transform the selected chain. The thing is that it does update itself... but only on the X axis. It does follow other axis, but not in realtime. Also, this problem occurs on both chains of bones, so I really don't know whats going on here.
Here's my code.
I'd upload the scene, but I'm not allowed to do so at work. Any idea if the problem comes from my code or simply from max?
I have this script I'm working on that allows to seamlessly go from IK to FK on a bone chain. I have an IK chain of bones and a FK chain. The IK chain should be the one skinned on the mesh. Whe you animate either the IK or FK chain, the other chain is supposed to update itself as you transform the selected chain. The thing is that it does update itself... but only on the X axis. It does follow other axis, but not in realtime. Also, this problem occurs on both chains of bones, so I really don't know whats going on here.
Here's my code.
test = ATTRIBUTES whenTest
(
FN applyRot =
(
$Arm.transform.controller.FK_Sub_Control.rotation.controller.Xrotation = $FK_Arm.rotation.controller.Xrotation
$Arm.transform.controller.FK_Sub_Control.rotation.controller.Yrotation = $FK_Arm.rotation.controller.Yrotation
$Arm.transform.controller.FK_Sub_Control.rotation.controller.Zrotation = $FK_Arm.rotation.controller.Zrotation
$ForeArm.transform.controller.FK_Sub_Control.rotation.controller.Xrotation = $FK_ForeArm.rotation.controller.Xrotation
$ForeArm.transform.controller.FK_Sub_Control.rotation.controller.Yrotation = $FK_ForeArm.rotation.controller.Yrotation
$ForeArm.transform.controller.FK_Sub_Control.rotation.controller.Zrotation = $FK_ForeArm.rotation.controller.Zrotation
$Hand.transform.controller.FK_Sub_Control.rotation.controller.Xrotation = $FK_Hand.rotation.controller.Xrotation
$Hand.transform.controller.FK_Sub_Control.rotation.controller.Yrotation = $FK_Hand.rotation.controller.Yrotation
$Hand.transform.controller.FK_Sub_Control.rotation.controller.Zrotation = $FK_Hand.rotation.controller.Zrotation
$Swivel.position = $Swivel_Pos.position
)
FN applyRotFK =
(
$FK_Arm.rotation.controller.Xrotation = $Arm.transform.controller.FK_Sub_Control.rotation.controller.Xrotation
$FK_Arm.rotation.controller.Yrotation = $Arm.transform.controller.FK_Sub_Control.rotation.controller.Yrotation
$FK_Arm.rotation.controller.Zrotation = $Arm.transform.controller.FK_Sub_Control.rotation.controller.Zrotation
$FK_ForeArm.rotation.controller.Xrotation = $ForeArm.transform.controller.FK_Sub_Control.rotation.controller.Xrotation
$FK_ForeArm.rotation.controller.Yrotation = $ForeArm.transform.controller.FK_Sub_Control.rotation.controller.Yrotation
$FK_ForeArm.rotation.controller.Zrotation = $ForeArm.transform.controller.FK_Sub_Control.rotation.controller.Zrotation
$FK_Hand.rotation.controller.Xrotation = $Hand.transform.controller.FK_Sub_Control.rotation.controller.Xrotation
$FK_Hand.rotation.controller.Yrotation = $Hand.transform.controller.FK_Sub_Control.rotation.controller.Yrotation
$FK_Hand.rotation.controller.Zrotation = $Hand.transform.controller.FK_Sub_Control.rotation.controller.Zrotation
)
FN selectchange =
(
IF $FK_ForeArm.isSelected == true THEN
(
deleteAllChangeHandlers id:#fkTest
when transform $ikTest changes id:#ikTest do
(
IF $ikTest.transform.controller.enabled == 1 THEN
(
applyRotFK()
)
ELSE
(
$ikTest.transform.controller.enabled = 1
)
)
)
IF $FK_Arm.isSelected == true THEN
(
deleteAllChangeHandlers id:#ikTest
when transform $FK_Arm changes id:#fkTest do
(
IF $ikTest.transform.controller.enabled == 0 THEN
(
applyRot()
)
ELSE
(
$ikTest.transform.controller.enabled = 0
)
)
)
IF $FK_ForeArm.isSelected == true THEN
(
deleteAllChangeHandlers id:#ikTest
when transform $FK_Arm changes id:#fkTest do
(
IF $ikTest.transform.controller.enabled == 0 THEN
(
applyRot()
)
ELSE
(
$ikTest.transform.controller.enabled = 0
)
)
)
)
)
custAttributes.add $.modifiers test
-- callbacks.addScript #filePostOpenProcess "$ikTest.modifiers.transformBox()" id:#testSelectionSetMonitor persistent:true
-- callbacks.addScript #selectionSetChanged "$ikTest.modifiers.selectchange()" id:#testSelectionSetMonitor persistent:true
I'd upload the scene, but I'm not allowed to do so at work. Any idea if the problem comes from my code or simply from max?