Tag Info

New answers tagged

0

There is only 1 optimization you need to implement: Vector2 Min, Max; Min = poly.Vertices[0]; Max = poly.Vertices[0]; for (int i = 1; i < poly.Vertices.Length; i++) { Vector2 Vertex = poly.Vertices[i]; if (Vertex.x < Min.x) { Min.x = Vertex.x; } else if (Vertex.x > Max.x) { Max.x = Vertex.x; } if ...


1

Please, at all cost, avoid using vector2(or 3 or 4 for that matter).Distance(). If you can, use DistanceSquared() instead. To get the actual distance, XNA uses the pythagorean theorem, which ultimately means that it needs to use the square root function. This is a relatively slow function. So use this instead: for (int x = 0; x < map.GetLength(0); x++) ...



Top 50 recent answers are included