Why does $ikchain screw up the way the leg is rotated?

I added $ikchain to the .qc file for the right and left leg, the left leg rotates the way I need it to, while the right leg, rotates the wrong way. How can I fix this? Also, I was looking at the valve dev wiki and said something about the “knee” option in the ikchain command. What does it do?


// Created by Crowbar 0.36.0.0

$ModelName "overwatch/mei/mei.mdl"

$Model "studio" "head.dmx" {

	
}

$BodyGroup "Tank"
{
	studio "tank.dmx"
	blank
}
$bodygroup "Tube"
{
	blank
	studio "tube.dmx"
}
$bodygroup "Tank Cover"
{
	studio "tank_cover.dmx"
	blank
}
$BodyGroup "Glasses"
{
	studio "glasses.dmx"
	blank
}
$BodyGroup "Glasses Glass"
{
	blank
	studio "glasses_glass.dmx"
}
$BodyGroup "Eyes"
{
	studio "eyes.dmx"
	blank
}
$BodyGroup "Hairpin"
{
	studio "hairpin.dmx"
	blank
}
$BodyGroup "Hair"
{
	studio "hair.dmx"
	blank
}
$bodygroup "Body"
{
	studio "body.dmx"
	blank
}
$bodygroup "Belt"
{
	studio "belt.dmx"
	blank
}
$bodygroup "Fur"
{
	studio "fur.dmx"
	blank
}

$cdmaterials "models/overwatch/mei"

$SurfaceProp "flesh"

$Contents "solid"

$EyePosition 0 0 70

$cbox -31 18 0 31 18 0

$MaxEyeDeflection 90

$TextureGroup "skinfamilies"
{
	{ "body"  "fur"  }
	{ "body2" "fur"  }
	{ "body3" "fur"  }
	{ "body4" "fur"  }
	{ "body5" "fur"  }
	{ "body6" "fur2" }
	{ "body7" "fur"  }
}
$ikchain "rfoot" "bone_0064" knee 0 45 0
$ikchain "lfoot" "bone_005A"
$Attachment "eyes" "bone_0011" 0.03 3.86 3.58 rotate -90 -90 0
$Attachment "mouth" "bone_0011" 0.8 -5.8 -0.15 rotate 0 -80 -90

$CBox 0 0 0 0 0 0

$BBox -25.0 -11.0 0 25.0 -11.0 65.044

$jigglebone "bone_00CF"
{
	is_flexible
	{
		length 100
		yaw_stiffness 100
		yaw_damping 5
		pitch_stiffness 100
		pitch_damping 5
		allow_length_flex 
		along_stiffness 100
		along_damping 5
		tip_mass 200

	}
}
$jigglebone "bone_00D0"
{
	is_flexible
	{
		length 100
		yaw_stiffness 100
		yaw_damping 5
		pitch_stiffness 100
		pitch_damping 5
		allow_length_flex 
		along_stiffness 100
		along_damping 5
		tip_mass 200

	}
}
$jigglebone "bone_00D1"
{
	is_flexible
	{
		length 100
		yaw_stiffness 100
		yaw_damping 5
		pitch_stiffness 100
		pitch_damping 5
		allow_length_flex 
		along_stiffness 100
		along_damping 5
		tip_mass 200

	}
}

$animation a_WalkS "anims\a_WalkS.dmx" {
	loop 
	fps 24
	walkframe 21 LX LY
}
$animation a_WalkSE "anims\a_WalkSE.dmx" {
	loop 
	fps 24 
	walkframe 21 LX LY 
}
$animation a_WalkE "anims\a_WalkE.dmx" {
	loop 
	fps 24 
	walkframe 21 LX LY 
}
$animation a_WalkNE "anims\a_WalkNE.dmx" {
	loop 
	fps 24 
	walkframe 21 LX LY 
}
$animation a_WalkN "anims\a_WalkN.dmx" {
	loop 
	fps 24 
	walkframe 21 LX LY 
}
$animation a_WalkNW "anims\a_WalkNW.dmx" {
	loop fps 24
	walkframe 21 LX LY
}
$animation a_WalkW "anims\a_WalkW.dmx" {
	loop 
	fps 24 
	walkframe 21 LX LY
} 
$animation a_WalkSW "anims\a_WalkSW.dmx" {
	loop
	fps 24
	walkframe 21 LX LY
}
$Sequence "ragdoll" {
	"anims\ragdoll.dmx"
	activity "ACT_DIERAGDOLL" 1
	fps 30
	loop
}
$sequence "idle" {
	"anims\idle.dmx"
	activity "ACT_IDLE" 1
	fps 30
	loop 
}
$sequence "intro" {
	"anims\intro.dmx"
	activity "ACT_IDLE_RELAXED" 1
	fps 30
	loop
}
$sequence "melee" {
	"anims\punch.dmx"
	activity "ACT_MELEE_ATTACK1" 1
	fps 30
}

$Sequence "walk_all" {
	"a_WalkS"
	"a_WalkSE"
	"a_WalkE"
	"a_WalkNE"
	"a_WalkN"
	"a_WalkNW"
	"a_WalkW"
	"a_WalkSW"
	"a_WalkS"
	activity "ACT_WALK" 1
	blend "move_yaw" -180 180
	blendwidth 9
	{ event 6006 11 "npc_mei" }
	{ event 6007 21 "npc_mei" }
	fadein 0.2
	fadeout 0.2
	node "walking"
	fps 24
	loop
}

$Sequence "walk_all_moderate" {
	"a_WalkS"
	"a_WalkSE"
	"a_WalkE"
	"a_WalkNE"
	"a_WalkN"
	"a_WalkNW"
	"a_WalkW"
	"a_WalkSW"
	"a_WalkS"
	activity "ACT_WALK" 1
	blend "move_yaw" -180 180
	blendwidth 9
	{ event 6006 11 "npc_mei" }
	{ event 6007 21 "npc_mei" }
	fadein 0.2
	fadeout 0.2
	node "walking"
	fps 24
	loop
}

$Sequence "run_all" {
	"a_WalkS"
	"a_WalkSE"
	"a_WalkE"
	"a_WalkNE"
	"a_WalkN"
	"a_WalkNW"
	"a_WalkW"
	"a_WalkSW"
	"a_WalkS"
	activity "ACT_RUN" 1
	blend "move_yaw" -180 180
	blendwidth 9
	{ event 6004 11 "npc_mei" }
	{ event 6005 21 "npc_mei" }
	fadein 0.2
	fadeout 0.2
	node "running"
	fps 30
	loop
}
$collisionjoints physics.dmx {

	$mass 200.0
	$inertia 10.00
	$damping 0.00
	$rotdamping 4.00
	$rootbone "bone_0002"

	$jointconstrain "bone_0053" x limit -20.00 20.00 0.00
	$jointconstrain "bone_0053" y limit -20.00 20.00 0.00
	$jointconstrain "bone_0053" z limit -20.00 20.00 0.00

	$jointconstrain "bone_005f" x limit -25.00 50.00 0.00
	$jointconstrain "bone_005f" y limit -100.00 20.00 0.00
	$jointconstrain "bone_005f" z limit -50.00 50.00 0.00

	$jointconstrain "bone_0055" x limit -25.00 50.00 0.00
	$jointconstrain "bone_0055" y limit -100.00 20.00 0.00
	$jointconstrain "bone_0055" z limit -50.00 50.00 0.00

	$jointconstrain "bone_0059" x limit 0.00 0.00 0.00
	$jointconstrain "bone_0059" y limit 0.00 120.00 0.00
	$jointconstrain "bone_0059" z limit 0.00 0.00 0.00

	$jointconstrain "bone_005a" x limit 0.00 0.00 0.00
	$jointconstrain "bone_005a" y limit -10.00 10.00 0.00
	$jointconstrain "bone_005a" z limit 0.00 0.00 0.00

	$jointconstrain "bone_0063" x limit 0.00 0.00 0.00
	$jointconstrain "bone_0063" y limit 0.00 120.00 0.00
	$jointconstrain "bone_0063" z limit 0.00 0.00 0.00

	$jointconstrain "bone_0004" x limit 0.00 0.00 0.00
	$jointconstrain "bone_0004" y limit 0.00 0.00 0.00
	$jointconstrain "bone_0004" z limit 0.00 0.00 0.00

	$jointconstrain "bone_0036" x limit -120.00 90.00 0.00
	$jointconstrain "bone_0036" y limit -180.00 180.00 0.00
	$jointconstrain "bone_0036" z limit -120.00 20.00 0.00

	$jointconstrain "bone_0037" x limit -80.00 20.00 0.00
	$jointconstrain "bone_0037" y limit -120.00 0.00 0.00
	$jointconstrain "bone_0037" z limit 0.00 0.00 0.00

	$jointconstrain "bone_003a" x limit -60.00 60.00 0.00
	$jointconstrain "bone_003a" y limit -20.00 20.00 0.00
	$jointconstrain "bone_003a" z limit -50.00 50.00 0.00

	$jointconstrain "bone_000d" x limit -120.00 90.00 0.00
	$jointconstrain "bone_000d" y limit -180.00 180.00 0.00
	$jointconstrain "bone_000d" z limit -20.00 120.00 0.00

	$jointconstrain "bone_000e" x limit -80.00 20.00 0.00
	$jointconstrain "bone_000e" y limit -120.00 0.00 0.00
	$jointconstrain "bone_000e" z limit 0.00 0.00 0.00

	$jointconstrain "bone_001c" x limit -80.00 80.00 0.00
	$jointconstrain "bone_001c" y limit -50.00 50.00 0.00
	$jointconstrain "bone_001c" z limit -60.00 60.00 0.00

	$jointconstrain "bone_0010" x limit -70.00 70.00 0.00
	$jointconstrain "bone_0010" y limit -60.00 60.00 0.00
	$jointconstrain "bone_0010" z limit -70.00 70.00 0.00

	$jointconstrain "bone_0064" x limit 0.00 0.00 0.00
	$jointconstrain "bone_0064" y limit -10.00 10.00 0.00
	$jointconstrain "bone_0064" z limit 0.00 0.00 0.00
}

[video]https://youtu.be/_cP-MW8V4DU[/video]