public static void DrawItem(AActor item, Vector2 screenSize) { Vector2 location = WorldToScreen(item.RootComponent().RelativeLocation, screenSize); if (location.X > screenSize.X || location.Y > screenSize.Y) { return; } DrawFactory.DrawText(item.IsItem, 7, new Vector2(location.X, location.Y), Color.Red); }
public static void DrawVehicle(AActor Vehicle, Vector2 screenSize) { Vector2 location = WorldToScreen(Vehicle.RootComponent().RelativeLocation, screenSize); if (location.X > screenSize.X || location.Y > screenSize.Y) { return; } DrawFactory.DrawText(Vehicle.IsVehicle, 18, new Vector2(location.X, location.Y), Color.Red); }
public static void DrawBox3d(AActor player, Vector2 screenSize, Color color) { SceneComponent RootComponent = player.RootComponent(); Vector3 loclLocation = Main.localPawn.RootComponent().RelativeLocation; Vector3 enimeLocation = RootComponent.RelativeLocation; float distince = Vector3.Distance(loclLocation, enimeLocation); Vector3 Head = player.GetBoneLocation(6); Head.Z += 50; Vector2 Heads2s = WorldToScreen(Head, screenSize); float l, w, h, o; l = 80f; o = 50f; //box size for standing player h = Vector3.Distance(player.GetBoneLocation(0), Head); w = h / 2; //Vector3.Distance(player.GetBoneLocation(63), player.GetBoneLocation(64)); float zOffset = -100f; //if (actor.Type == ActorTypes.Vehicle) //vehicles have a bigger box //{ // zOffset = 50; // l = 200f; w = 160f; h = 80f; o = 0f; //} //build box Vector3 p00 = new Vector3(o, -w / 2, 0f); Vector3 p01 = new Vector3(o, w / 2, 0f); Vector3 p02 = new Vector3(o - l, w / 2, 0f); Vector3 p03 = new Vector3(o - l, -w / 2, 0f); //rotate rectangle to match actor rotation float theta1 = 2.0f * (float)Math.PI * (Main.cameraManager.CameraCache.POV.Rotation.Pitch) / 180.0f; Matrix rotM = Matrix.RotationZ((float)(theta1 / 2)); // rotate around Z-axis Vector3 curPos = new Vector3(RootComponent.RelativeLocation.X, RootComponent.RelativeLocation.Y, RootComponent.RelativeLocation.Z + zOffset); p00 = Vector3.TransformCoordinate(p00, rotM) + curPos; p01 = Vector3.TransformCoordinate(p01, rotM) + curPos; p02 = Vector3.TransformCoordinate(p02, rotM) + curPos; p03 = Vector3.TransformCoordinate(p03, rotM) + curPos; Vector2 s00 = WorldToScreen(p00, screenSize); Vector2 s01 = WorldToScreen(p01, screenSize); Vector2 s02 = WorldToScreen(p02, screenSize); Vector2 s03 = WorldToScreen(p03, screenSize); Vector2[] square0 = { s00, s01, s02, s03, s00 }; for (int x = 0; x < square0.Length - 1; x++) { DrawFactory.DrawLine(square0[x].X, square0[x].Y, square0[x + 1].X, square0[x + 1].Y, 2, color); } // top rectangle p00.Z += h; s00 = WorldToScreen(p00, screenSize); p01.Z += h; s01 = WorldToScreen(p01, screenSize); p02.Z += h; s02 = WorldToScreen(p02, screenSize); p03.Z += h; s03 = WorldToScreen(p03, screenSize); Vector2[] square1 = { s00, s01, s02, s03, s00 }; for (int x = 0; x < square1.Length - 1; x++) { DrawFactory.DrawLine(square1[x].X, square1[x].Y, square1[x + 1].X, square1[x + 1].Y, 2, color); } // upper/lower rectangles get connected DrawFactory.DrawLine(square0[0].X, square0[0].Y, square1[0].X, square1[0].Y, 2, color); DrawFactory.DrawLine(square0[1].X, square0[1].Y, square1[1].X, square1[1].Y, 2, color); DrawFactory.DrawLine(square0[2].X, square0[2].Y, square1[2].X, square1[2].Y, 2, color); DrawFactory.DrawLine(square0[3].X, square0[3].Y, square1[3].X, square1[3].Y, 2, color); }