Beispiel #1
0
        /// <summary>
        ///     Draws a box around the specified entity
        /// </summary>
        /// <param name="e">The entity to draw around</param>
        /// <param name="c">The box color</param>
        public void DrawEntBox(Entity e, Color c)
        {
            var size     = e.Model.GetDimensions();
            var location = e.Position - (size / 2);

            new Rectangle3D(location, size).Rotate(GTAFuncs.GetEntityQuaternion(e)).DrawWireFrame(c, true);
        }
Beispiel #2
0
        private List <Point> getScreenBounds(Entity e)
        {
            var            size         = e.Model.GetDimensions();
            var            location     = e.Position - (size / 2);
            Rectangle3D    rect         = new Rectangle3D(location, size).Rotate(GTAFuncs.GetEntityQuaternion(e));
            List <Vector3> points       = (from p in rect.Corners.ToList() select p.Value).ToList();
            List <Point>   screenPoints = new List <Point>();

            foreach (Vector3 p in points)
            {
                float x = 0, y = 0;
                if (getScreenPoint(p, ref x, ref y))
                {
                    screenPoints.Add(new Point((int)x, (int)y));
                }
            }
            return(screenPoints);
        }
Beispiel #3
0
        public Car(Vehicle v, List <Point> screenBounds, float distance, Point CenterCam)
        {
            AccInput          = ((Vehicle)v).Acceleration;
            CarType           = ((Vehicle)v).ClassType.ToString();
            CenterCamPosition = CenterCam;
            DistanceToCam     = distance;
            Gear          = ((Vehicle)v).CurrentGear;
            Handle        = v.Handle;
            Position      = v.Position;
            Rotation      = v.Rotation;
            RPM           = ((Vehicle)v).CurrentRPM;
            ScreenBounds  = screenBounds;
            Speed         = ((Vehicle)v).Speed;
            SteeringAngle = ((Vehicle)v).SteeringAngle;
            WheelSpeed    = ((Vehicle)v).WheelSpeed;
            var         size     = v.Model.GetDimensions();
            var         location = v.Position - (size / 2);
            Rectangle3D rect     = new Rectangle3D(location, size).Rotate(GTAFuncs.GetEntityQuaternion(v));

            Bounds = (from p in rect.Corners.ToList() select p.Value).ToList();
        }
Beispiel #4
0
        public void DrawLightBox(Entity e)
        {
            //Distance from base to trafic light
            Vector3     off  = new Vector3(Vector3.Dot(e.ForwardVector, offset), Vector3.Dot(e.RightVector, offset), Vector3.Dot(e.UpVector, offset));
            Rectangle3D rect = new Rectangle3D(e.Position + off, new Vector3(.7f, .1f, 1.3f)).Rotate(GTAFuncs.GetEntityQuaternion(e));

            rect.DrawWireFrame(Color.Blue);
        }