Начинающий
Начинающий
- Статус
- Оффлайн
- Регистрация
- 26 Ноя 2018
- Сообщения
- 57
- Реакции
- 18
Всем привет,на форуме в первые надеюсь на вашу помощь.У меня есть чит на c# Mono,в нем я пытаюсь сделать ESP Skeleton рисуют от кости до кости (игрока) линий,но вот из-за линий начинаються сильные лагги в чем могут быть проблемы? Неправильный шейдер или еще что то кто сможет помогите мне с этим пожалуйсто.
public static void DrawLine100(Vector2 pointA, Vector2 pointB, Color color, float width) Это сам метод отрисовки линий
{
float num = pointB.x - pointA.x;
float num2 = pointB.y - pointA.y;
float num3 = Mathf.Sqrt(num * num + num2 * num2);
if (num3 >= 0.001f)
{
Texture2D image = new Texture2D(1, 1);
float num4 = width * num2 / num3;
float num5 = width * num / num3;
Matrix4x4 identity = Matrix4x4.identity;
identity.m00 = num;
identity.m01 = -num4;
identity.m03 = pointA.x + 0.5f * num4;
identity.m10 = num2;
identity.m11 = num5;
identity.m13 = pointA.y - 0.5f * num5;
GL.PushMatrix();
GL.MultMatrix(identity);
GUI.color = color;
GUI.DrawTexture(ZatsRenderer.linesize, image);
GL.PopMatrix();
}
}
private static Rect linesize;
Transform[] heads2 = killer6.Human.Heads; // Кости головы в массиве,всего 2 элемента в массиве под индексами 0 и 1
for (int j = 0; j < heads2.Length; j++) перебор массива
{
if (j + 1 < heads2.Length && heads2[j] != null && heads2[j + 1] != null && this.World2Screen(heads2[j]).z > 0f && this.World2Screen(heads2[j + 1]).z > 0f && heads2[j].transform.position != Vector3.zero)
{
ZatsRenderer.DrawLine100(this.World2Screen(heads2[j]), this.World2Screen(heads2[j + 1]), new Color(this.espcolorgb1, this.espcolorgb2, this.espcolorgb3, this.espcolorgb4), Class1.speedScale); Вот сама линия которая рисуеться от шей до головы.
}
}
public Vector3 World2Screen(Transform bone) метод перевода координат из мировых в 2д координаты
{
Vector3 zero = Vector3.zero;
if (this.maincamera == null)
{
this.maincamera = Camera.main;
}
Vector3 vector = this.maincamera.WorldToScreenPoint(bone.transform.position);
vector.y = (float)Screen.height - vector.y;
if (vector.z > 0f)
{
return vector;
}
return zero;
}
Class1.speedScale // Ширина линий
Кто может помогите с лаггами непонимаю из-за чего лагает((
public static void DrawLine100(Vector2 pointA, Vector2 pointB, Color color, float width) Это сам метод отрисовки линий
{
float num = pointB.x - pointA.x;
float num2 = pointB.y - pointA.y;
float num3 = Mathf.Sqrt(num * num + num2 * num2);
if (num3 >= 0.001f)
{
Texture2D image = new Texture2D(1, 1);
float num4 = width * num2 / num3;
float num5 = width * num / num3;
Matrix4x4 identity = Matrix4x4.identity;
identity.m00 = num;
identity.m01 = -num4;
identity.m03 = pointA.x + 0.5f * num4;
identity.m10 = num2;
identity.m11 = num5;
identity.m13 = pointA.y - 0.5f * num5;
GL.PushMatrix();
GL.MultMatrix(identity);
GUI.color = color;
GUI.DrawTexture(ZatsRenderer.linesize, image);
GL.PopMatrix();
}
}
private static Rect linesize;
Transform[] heads2 = killer6.Human.Heads; // Кости головы в массиве,всего 2 элемента в массиве под индексами 0 и 1
for (int j = 0; j < heads2.Length; j++) перебор массива
{
if (j + 1 < heads2.Length && heads2[j] != null && heads2[j + 1] != null && this.World2Screen(heads2[j]).z > 0f && this.World2Screen(heads2[j + 1]).z > 0f && heads2[j].transform.position != Vector3.zero)
{
ZatsRenderer.DrawLine100(this.World2Screen(heads2[j]), this.World2Screen(heads2[j + 1]), new Color(this.espcolorgb1, this.espcolorgb2, this.espcolorgb3, this.espcolorgb4), Class1.speedScale); Вот сама линия которая рисуеться от шей до головы.
}
}
public Vector3 World2Screen(Transform bone) метод перевода координат из мировых в 2д координаты
{
Vector3 zero = Vector3.zero;
if (this.maincamera == null)
{
this.maincamera = Camera.main;
}
Vector3 vector = this.maincamera.WorldToScreenPoint(bone.transform.position);
vector.y = (float)Screen.height - vector.y;
if (vector.z > 0f)
{
return vector;
}
return zero;
}
Class1.speedScale // Ширина линий
Кто может помогите с лаггами непонимаю из-за чего лагает((