SA.FullBodyIK._LimitToPlaneDirY C# (CSharp) Method

_LimitToPlaneDirY() public static method

public static _LimitToPlaneDirY ( Vector3 &dir, Vector3 planeDir, float thetaY ) : bool
dir Vector3
planeDir Vector3
thetaY float
return bool
		public static bool _LimitToPlaneDirY( ref Vector3 dir, Vector3 planeDir, float thetaY )
		{
			float d = Vector3.Dot( dir, planeDir );
			if( d <= IKEpsilon && d >= -IKEpsilon ) {
				return false;
			}

			if( d <= thetaY && d >= -thetaY ) {
				return true;
			}

			Vector3 tmp = dir - planeDir * d;
			float tmpLen = SAFBIKVecLength( ref tmp );
			if( tmpLen <= FLOAT_EPSILON ) {
				return false;
			}

			float targetLen = SAFBIKSqrt( 1.0f - thetaY * thetaY );

			tmp *= targetLen / tmpLen;

			dir = tmp;
			if( d >= 0.0f ) {
				dir += planeDir * thetaY;
			} else {
				dir -= planeDir * thetaY;
			}

			return true;
		}
FullBodyIK