Exemplo n.º 1
0
        public static void DebugGraphicHandler(object sender, GraphicsEventArgs e)
        {
            var me = Game.LocalPlayer.Character;

            var nearbyPeds = new List <Ped>(me.GetNearbyPeds(5))
            {
                me
            };


            using (var disposableCamera = new DisposableCamera(DisposableCamera.DefaultScriptedCamera))
            {
                var camera = disposableCamera.Camera;
                camera.SetCameraValues(Utility.GetGameplayCameraValues());

                foreach (var ped in nearbyPeds)
                {
                    var pedBox = new PedBoundingBox(ped);
                    if (pedBox.ShouldDraw(camera))
                    {
                        pedBox.Draw(e.Graphics, Color.Red);
                        pedBox.ToDetectedObject()?.BoundingRect?.Draw(e.Graphics, Color.Blue);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void DrawBBoxes()
        {
            foreach (var ped in peds)
            {
                using (var disposableCamera = new DisposableCamera(DisposableCamera.DefaultScriptedCamera))
                {
                    var camera  = disposableCamera.Camera;
                    var headBox = new HeadBoundingBox(ped);
                    if (headBox.ShouldDraw(camera))
                    {
                        headBox.DebugDraw3D(Color.Red);
                    }

                    var chestBox = new ChestBoundingBox(ped);
                    if (chestBox.ShouldDraw(camera))
                    {
                        chestBox.DebugDraw3D(Color.Blue);
                    }

                    var pedBox = new PedBoundingBox(ped);

                    if (pedBox.ShouldDraw(camera))
                    {
                        pedBox.DebugDraw3D(Color.Green);
                    }

                    var weapon = ped.Inventory.EquippedWeaponObject;
                    if (weapon && weapon.IsVisible)
                    {
                        var weaponBox = new WeaponBoundingBox(weapon);
                        if (weaponBox.ShouldDraw(camera))
                        {
                            weaponBox.DebugDraw3D(Color.Purple);
                        }
                    }
                }
            }
        }