Exemplo n.º 1
0
        // Token: 0x060034AD RID: 13485 RVA: 0x000E5F50 File Offset: 0x000E4150
        public static Vector3 GetConeNextPoint(Core.Joint joint, Vector3 obj)
        {
            if (GenericMath.ConeBounded(joint, obj))
            {
                return(obj);
            }
            Vector3 pos     = joint.pos;
            Vector3 v       = obj - pos;
            Vector3 vector  = GenericMath.TransformVector(joint.axis, joint.rot);
            float   num     = GenericMath.VectorsAngle(v, pos + vector);
            float   num2    = Mathf.Cos(num * 0.017453292f) * v.magnitude;
            float   d       = num2 * (Mathf.Tan(num * 0.017453292f) - Mathf.Tan(joint.maxAngle * 0.017453292f));
            Vector3 vector2 = joint.joint.position + GenericMath.TransformVector(vector * num2, joint.rot) - obj;
            float   f       = Vector3.Dot(joint.joint.position + GenericMath.TransformVector(vector, joint.rot), v.normalized);

            return((vector2.normalized * d + obj) * Mathf.Clamp01(Mathf.Sign(f)) + pos * Mathf.Clamp01(-Mathf.Sign(f)));
        }