scripts
This commit is contained in:
@@ -0,0 +1,180 @@
|
||||
using System;
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
namespace UnityEngine
|
||||
{
|
||||
// Token: 0x0200044F RID: 1103
|
||||
[UsedByNativeCode]
|
||||
public struct Plane
|
||||
{
|
||||
// Token: 0x060038A2 RID: 14498 RVA: 0x0006189C File Offset: 0x0005FA9C
|
||||
public Plane(Vector3 inNormal, Vector3 inPoint)
|
||||
{
|
||||
this.m_Normal = Vector3.Normalize(inNormal);
|
||||
this.m_Distance = -Vector3.Dot(inNormal, inPoint);
|
||||
}
|
||||
|
||||
// Token: 0x060038A3 RID: 14499 RVA: 0x000618BC File Offset: 0x0005FABC
|
||||
public Plane(Vector3 inNormal, float d)
|
||||
{
|
||||
this.m_Normal = Vector3.Normalize(inNormal);
|
||||
this.m_Distance = d;
|
||||
}
|
||||
|
||||
// Token: 0x060038A4 RID: 14500 RVA: 0x000618D4 File Offset: 0x0005FAD4
|
||||
public Plane(Vector3 a, Vector3 b, Vector3 c)
|
||||
{
|
||||
this.m_Normal = Vector3.Normalize(Vector3.Cross(b - a, c - a));
|
||||
this.m_Distance = -Vector3.Dot(this.m_Normal, a);
|
||||
}
|
||||
|
||||
// Token: 0x17000D04 RID: 3332
|
||||
// (get) Token: 0x060038A5 RID: 14501 RVA: 0x00061908 File Offset: 0x0005FB08
|
||||
// (set) Token: 0x060038A6 RID: 14502 RVA: 0x00061924 File Offset: 0x0005FB24
|
||||
public Vector3 normal
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Normal;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Normal = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000D05 RID: 3333
|
||||
// (get) Token: 0x060038A7 RID: 14503 RVA: 0x00061930 File Offset: 0x0005FB30
|
||||
// (set) Token: 0x060038A8 RID: 14504 RVA: 0x0006194C File Offset: 0x0005FB4C
|
||||
public float distance
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Distance;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Distance = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060038A9 RID: 14505 RVA: 0x00061958 File Offset: 0x0005FB58
|
||||
public void SetNormalAndPosition(Vector3 inNormal, Vector3 inPoint)
|
||||
{
|
||||
this.m_Normal = Vector3.Normalize(inNormal);
|
||||
this.m_Distance = -Vector3.Dot(inNormal, inPoint);
|
||||
}
|
||||
|
||||
// Token: 0x060038AA RID: 14506 RVA: 0x00061978 File Offset: 0x0005FB78
|
||||
public void Set3Points(Vector3 a, Vector3 b, Vector3 c)
|
||||
{
|
||||
this.m_Normal = Vector3.Normalize(Vector3.Cross(b - a, c - a));
|
||||
this.m_Distance = -Vector3.Dot(this.m_Normal, a);
|
||||
}
|
||||
|
||||
// Token: 0x060038AB RID: 14507 RVA: 0x000619AC File Offset: 0x0005FBAC
|
||||
public void Flip()
|
||||
{
|
||||
this.m_Normal = -this.m_Normal;
|
||||
this.m_Distance = -this.m_Distance;
|
||||
}
|
||||
|
||||
// Token: 0x17000D06 RID: 3334
|
||||
// (get) Token: 0x060038AC RID: 14508 RVA: 0x000619D0 File Offset: 0x0005FBD0
|
||||
public Plane flipped
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Plane(-this.m_Normal, -this.m_Distance);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060038AD RID: 14509 RVA: 0x000619FC File Offset: 0x0005FBFC
|
||||
public void Translate(Vector3 translation)
|
||||
{
|
||||
this.m_Distance += Vector3.Dot(this.m_Normal, translation);
|
||||
}
|
||||
|
||||
// Token: 0x060038AE RID: 14510 RVA: 0x00061A18 File Offset: 0x0005FC18
|
||||
public static Plane Translate(Plane plane, Vector3 translation)
|
||||
{
|
||||
return new Plane(plane.m_Normal, plane.m_Distance += Vector3.Dot(plane.m_Normal, translation));
|
||||
}
|
||||
|
||||
// Token: 0x060038AF RID: 14511 RVA: 0x00061A58 File Offset: 0x0005FC58
|
||||
public Vector3 ClosestPointOnPlane(Vector3 point)
|
||||
{
|
||||
float num = Vector3.Dot(this.m_Normal, point) + this.m_Distance;
|
||||
return point - this.m_Normal * num;
|
||||
}
|
||||
|
||||
// Token: 0x060038B0 RID: 14512 RVA: 0x00061A94 File Offset: 0x0005FC94
|
||||
public float GetDistanceToPoint(Vector3 point)
|
||||
{
|
||||
return Vector3.Dot(this.m_Normal, point) + this.m_Distance;
|
||||
}
|
||||
|
||||
// Token: 0x060038B1 RID: 14513 RVA: 0x00061ABC File Offset: 0x0005FCBC
|
||||
public bool GetSide(Vector3 point)
|
||||
{
|
||||
return Vector3.Dot(this.m_Normal, point) + this.m_Distance > 0f;
|
||||
}
|
||||
|
||||
// Token: 0x060038B2 RID: 14514 RVA: 0x00061AEC File Offset: 0x0005FCEC
|
||||
public bool SameSide(Vector3 inPt0, Vector3 inPt1)
|
||||
{
|
||||
float distanceToPoint = this.GetDistanceToPoint(inPt0);
|
||||
float distanceToPoint2 = this.GetDistanceToPoint(inPt1);
|
||||
return (distanceToPoint > 0f && distanceToPoint2 > 0f) || (distanceToPoint <= 0f && distanceToPoint2 <= 0f);
|
||||
}
|
||||
|
||||
// Token: 0x060038B3 RID: 14515 RVA: 0x00061B44 File Offset: 0x0005FD44
|
||||
public bool Raycast(Ray ray, out float enter)
|
||||
{
|
||||
float num = Vector3.Dot(ray.direction, this.m_Normal);
|
||||
float num2 = -Vector3.Dot(ray.origin, this.m_Normal) - this.m_Distance;
|
||||
bool flag;
|
||||
if (Mathf.Approximately(num, 0f))
|
||||
{
|
||||
enter = 0f;
|
||||
flag = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
enter = num2 / num;
|
||||
flag = enter > 0f;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x060038B4 RID: 14516 RVA: 0x00061BB4 File Offset: 0x0005FDB4
|
||||
public override string ToString()
|
||||
{
|
||||
return UnityString.Format("(normal:({0:F1}, {1:F1}, {2:F1}), distance:{3:F1})", new object[]
|
||||
{
|
||||
this.m_Normal.x,
|
||||
this.m_Normal.y,
|
||||
this.m_Normal.z,
|
||||
this.m_Distance
|
||||
});
|
||||
}
|
||||
|
||||
// Token: 0x060038B5 RID: 14517 RVA: 0x00061C20 File Offset: 0x0005FE20
|
||||
public string ToString(string format)
|
||||
{
|
||||
return UnityString.Format("(normal:({0}, {1}, {2}), distance:{3})", new object[]
|
||||
{
|
||||
this.m_Normal.x.ToString(format),
|
||||
this.m_Normal.y.ToString(format),
|
||||
this.m_Normal.z.ToString(format),
|
||||
this.m_Distance.ToString(format)
|
||||
});
|
||||
}
|
||||
|
||||
// Token: 0x04001124 RID: 4388
|
||||
private Vector3 m_Normal;
|
||||
|
||||
// Token: 0x04001125 RID: 4389
|
||||
private float m_Distance;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user