SA.FullBodyIK.BodyIK.SolverInternal._SolveArms C# (CSharp) Method

_SolveArms() public method

public _SolveArms ( _UpperSolverArmsTemp &armsTemp, int idx0 ) : void
armsTemp _UpperSolverArmsTemp
idx0 int
return void
				void _SolveArms( ref _UpperSolverArmsTemp armsTemp, int idx0 )
				{
					int idx1 = 1 - idx0;

					float neckHeadPull = _solverCaches.neckHeadPull;
					float[] armPull = _solverCaches.armPull;
					float[] elbowPull = _solverCaches.elbowPull;
					float[] wristPull = _solverCaches.wristPull;
					float[] neckHeadToFullArmPull = _solverCaches.neckHeadToFullArmPull;

					if( wristPull[idx0] > IKEpsilon || elbowPull[idx0] > IKEpsilon || armPull[idx0] > IKEpsilon || neckHeadPull > IKEpsilon ) {
						if( armPull[idx0] > IKEpsilon ) {
							_SolveArmsToArms( ref armsTemp, armPull[idx0], idx0 );
						}
						if( (wristPull[idx0] > IKEpsilon || elbowPull[idx0] > IKEpsilon) &&
							arms.SolveTargetBeginPos( idx0, ref armsTemp.armPos[idx0] ) ) {
							armsTemp.armPos[idx0] = arms.targetBeginPos[idx0]; // Update armPos
							if( armsTemp.shoulderEnabled ) {
								_KeepLength( ref armsTemp.shoulderPos[idx0], ref armsTemp.armPos[idx0], _solverCaches.shoulderToArmLength[idx0] );
								if( neckHeadPull > IKEpsilon ) {
									_SolveArmsToNeck( ref armsTemp, neckHeadToFullArmPull[idx0], idx0 ); // Contain wristPull/neckPull.
									_KeepLength( ref armsTemp.armPos[idx0], ref armsTemp.shoulderPos[idx0], _solverCaches.shoulderToArmLength[idx0] );
								}
								_KeepLength( ref armsTemp.shoulderPos[idx1], ref armsTemp.shoulderPos[idx0], _solverCaches.nearArmToNearArmLen );
								_KeepLength( ref armsTemp.armPos[idx1], ref armsTemp.shoulderPos[idx1], _solverCaches.shoulderToArmLength[idx1] );
							} else {
								if( neckHeadPull > IKEpsilon ) {
									_SolveArmsToNeck( ref armsTemp, neckHeadToFullArmPull[idx0], idx0 );
								}
								_KeepLength( ref armsTemp.armPos[idx1], ref armsTemp.armPos[idx0], _solverCaches.armToArmLen );
							}
						} else if( armPull[idx0] > IKEpsilon || neckHeadPull > IKEpsilon ) {
							if( armPull[idx0] > IKEpsilon ) {
								if( armsTemp.shoulderEnabled ) {
									_KeepLength( ref armsTemp.shoulderPos[idx0], ref armsTemp.armPos[idx0], _solverCaches.shoulderToArmLength[idx0] );
								}
							}
							if( neckHeadPull > IKEpsilon ) {
								_SolveArmsToNeck( ref armsTemp, neckHeadToFullArmPull[idx0], idx0 ); // Contain wristPull/neckPull.
								if( armsTemp.shoulderEnabled ) {
									_KeepLength( ref armsTemp.armPos[idx0], ref armsTemp.shoulderPos[idx0], _solverCaches.shoulderToArmLength[idx0] );
								}
							}
							if( armsTemp.shoulderEnabled ) {
								_KeepLength( ref armsTemp.shoulderPos[idx1], ref armsTemp.shoulderPos[idx0], _solverCaches.nearArmToNearArmLen );
								_KeepLength( ref armsTemp.armPos[idx1], ref armsTemp.shoulderPos[idx1], _solverCaches.shoulderToArmLength[idx1] );
							} else {
								_KeepLength( ref armsTemp.armPos[idx1], ref armsTemp.armPos[idx0], _solverCaches.armToArmLen );
							}
						}
					}
				}