Пример #1
0
        private void BurstTyreMethod(Vehicle veh, string wheelBone, EWheel wheel, Vector3 vehModelMinDim, Vector3 pointA, Vector3 pointB)
        {
            if (veh.HasBone(wheelBone) && !Common.IsVehicleTyreBurst(veh, wheel))
            {
                Vector3 wheelPos = veh.GetBonePosition(wheelBone);

                if (veh.IsOnAllWheels)
                {
                    wheelPos = veh.Wheels[(int)wheel].LastContactPoint;
                }
                else
                {
                    wheelPos.Z += (vehModelMinDim.Z / 2);
                };

                Vector3 wheelClosestPoint            = Common.GetClosestPointOnLineSegment(pointA, pointB, wheelPos);
                float   wheelClosestPointSqrDistance = Vector3.DistanceSquared(wheelPos, wheelClosestPoint);

                if (wheelClosestPointSqrDistance < 0.275f * 0.275f)
                {
                    Common.SetVehicleTyreBurst(veh, wheel, false, 940f);
                }

#if DEBUG
                Common.DrawLine(wheelPos, wheelClosestPoint, Color.Green);
                new ResText(wheelBone + "~n~" + wheelClosestPointSqrDistance.ToString(), new Point((int)World.ConvertWorldPositionToScreenPosition(wheelPos).X, (int)World.ConvertWorldPositionToScreenPosition(wheelPos).Y), 0.235f, Color.Green).Draw();
#endif
            }
        }
Пример #2
0
 public static bool IsVehicleTyreBurst(Vehicle vehicle, EWheel wheel)
 {
     return(NativeFunction.CallByName <bool>("IS_VEHICLE_TYRE_BURST", vehicle, (int)wheel, false));
 }
Пример #3
0
 public static void SetVehicleTyreBurst(Vehicle vehicle, EWheel wheel, bool onRim, float damage)
 {
     NativeFunction.CallByName <uint>("SET_VEHICLE_TYRE_BURST", vehicle, (int)wheel, onRim, damage);
 }