Beispiel #1
0
        internal void ReturnAnaBones()
        {
            if (m_bpAnaTarget != null)
            {
                m_bpAnaTarget.localRotation = Quaternion.identity;
            }

            if (MathHelpers.ApproximatelyZero(currentAnaPull) || m_anaPullBones == null)
            {
                return;
            }

            var returnRate = m_collisionOptions.anaReturnRate * Time.deltaTime;

            if (currentAnaPull > returnRate)
            {
                currentAnaPull -= returnRate;
            }
            else if (currentAnaPull < -returnRate)
            {
                currentAnaPull += returnRate;
            }
            else
            {
                currentAnaPull = 0;
            }

            for (var anaBone = 0; anaBone < m_anaPullBones.Count; anaBone++)
            {
                m_anaPullBones[anaBone].localPosition = BoneNames.AnaPullWeights[anaBone] * currentAnaPull * Vector3.up;
            }
        }
Beispiel #2
0
        internal void ReturnKokanBones()
        {
            if (m_innerKokan != null)
            {
                m_innerKokan.localRotation = Quaternion.identity;
            }

            if (MathHelpers.ApproximatelyZero(currentKokanPull) || m_kokanPullBones == null)
            {
                return;
            }

            var returnRate = m_collisionOptions.kokanReturnRate * Time.deltaTime;

            if (currentKokanPull > returnRate)
            {
                currentKokanPull -= returnRate;
            }
            else if (currentKokanPull < -returnRate)
            {
                currentKokanPull += returnRate;
            }
            else
            {
                currentKokanPull = 0;
            }

            for (var kokanBone = 0; kokanBone < m_kokanPullBones.Count; kokanBone++)
            {
                m_kokanPullBones[kokanBone].localPosition = BoneNames.KokanPullWeights[kokanBone] * currentKokanPull * Vector3.up;
            }
        }
Beispiel #3
0
        internal void ReturnOralBones()
        {
            if (MathHelpers.ApproximatelyZero(currentOralPull) || m_oralPullBone == null)
            {
                return;
            }

            var returnRate = m_collisionOptions.oralReturnRate * Time.deltaTime;

            if (currentOralPull > returnRate)
            {
                currentOralPull -= returnRate;
            }
            else if (currentOralPull < -returnRate)
            {
                currentOralPull += returnRate;
            }
            else
            {
                currentOralPull = 0;
            }

            m_oralPullBone.localPosition = currentOralPull * m_oralPullBone.InverseTransformDirection(currentOralDanDirection);
        }
Beispiel #4
0
        private bool FindIntersectValues(Vector3 lineVector, Vector3 offsetVector, Vector3 FVxLV, Vector3 TWxLV, Vector3 OFxLV, Vector3 LVxFW, double u, out double v, out double t)
        {
            double Cu = 0;

            v = 0;
            t = 0;

            for (MathHelpers.Axis axis = MathHelpers.Axis.X; axis <= MathHelpers.Axis.Z; axis++)
            {
                if (axis == MathHelpers.Axis.X)
                {
                    Cu = FVxLV.x + TWxLV.x * u;
                    if (!MathHelpers.ApproximatelyZero(Cu))
                    {
                        v = (OFxLV.x + LVxFW.x * u) / Cu;
                        break;
                    }
                }
                else if (axis == MathHelpers.Axis.Y)
                {
                    Cu = FVxLV.y + TWxLV.y * u;
                    if (!MathHelpers.ApproximatelyZero(Cu))
                    {
                        v = (OFxLV.y + LVxFW.y * u) / Cu;
                        break;
                    }
                }
                else
                {
                    Cu = FVxLV.z + TWxLV.z * u;
                    if (!MathHelpers.ApproximatelyZero(Cu))
                    {
                        v = (OFxLV.z + LVxFW.z * u) / Cu;
                        break;
                    }
                }
            }

            if (MathHelpers.ApproximatelyZero(Cu))
            {
                return(false);
            }

            if (!MathHelpers.ApproximatelyZero(lineVector.x))
            {
                t = (-offsetVector.x + firstVector.x * v + (forwardVector.x + twistVector.x * v) * u) / lineVector.x;
            }
            else if (!MathHelpers.ApproximatelyZero(lineVector.y))
            {
                t = (-offsetVector.y + firstVector.y * v + (forwardVector.y + twistVector.y * v) * u) / lineVector.y;
            }
            else if (!MathHelpers.ApproximatelyZero(lineVector.z))
            {
                t = (-offsetVector.z + firstVector.z * v + (forwardVector.z + twistVector.z * v) * u) / lineVector.z;
            }
            else
            {
                return(false);
            }

            return(true);
        }