12 public RaycastResultHelper(RaycastHit hit, LayerMask surface) : this(hit.collider, hit.point, hit.normal, hit.distance, hit.textureCoord, hit.textureCoord2, surface)
16 public RaycastResultHelper(Collider collider, Vector3 point, Vector3 normal,
float distance, Vector2 textureCoord, Vector2 textureCoord2, LayerMask surface)
20 if (this.layer == surface.value)
27 this.collider = collider;
32 this.distance = distance;
33 this.transform = null;
34 this.textureCoord = textureCoord;
35 this.textureCoord2 = textureCoord2;
38 private Collider collider;
39 public Collider Collider
41 get {
return this.collider; }
42 private set { this.collider = value; }
48 get {
return this.layer; }
49 private set { this.layer = value; }
52 private Vector3 normal;
55 get {
return this.normal; }
56 private set { this.normal = value; }
59 private float distance;
62 get {
return this.distance; }
63 private set { this.distance = value; }
66 private Vector3 point;
69 get {
return this.point; }
70 private set { this.point = value; }
73 private Transform transform;
74 public Transform Transform
78 if (this.transform == null &&
79 this.Collider != null)
81 this.transform = this.Collider.transform;
84 return this.transform;
88 private Vector2 textureCoord;
89 public Vector2 TextureCoord
91 get {
return this.textureCoord; }
92 private set { this.textureCoord = value; }
95 private Vector2 textureCoord2;
96 public Vector2 TextureCoord2
98 get {
return this.textureCoord2; }
99 private set { this.textureCoord2 = value; }
105 return new Vector3(textureCoord.x, textureCoord.y, 1f - Mathf.Sqrt(textureCoord.x * textureCoord.x + textureCoord.y * textureCoord.y));
109 normal = GetNormalFromTextureCoord();
119 return string.Format(
120 "Collider: {1}{0}Game object: {2}{0}Distance: {3}{0}Normal: {4}{0}Point: {5}{0}Texture coord: {6}{0}Texture coord 2: {7}",
122 this.Collider != null ?
this.Collider.ToString() :
"None",
123 this.Collider != null ? this.Collider.gameObject.ToString() :
"None",