Math library
Classes
Functions
private void ~Math() | ||
proto static float AbsFloat(float f) | Returns absolute value | more… |
proto static int AbsInt(int i) | Returns absolute value | more… |
proto static float Acos(float c) | Returns angle in radians from cosinus | more… |
proto static float AreaOfRightTriangle(float s, float a) | Returns area of a right triangle | more… |
proto static float Asin(float s) | Returns angle in radians from sinus | more… |
proto static float Atan(float x) | Returns angle in radians from tangent | more… |
proto static float Atan2(float y, float x) | Returns angle in radians from tangent | more… |
proto static float Ceil(float f) | Returns ceil of value | more… |
static vector CenterOfRectangle(vector min, vector max) | more… | |
proto static float Clamp(float value, float min, float max) | Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max' | more… |
proto static float Cos(float angle) | Returns cosinus of angle in radians | more… |
proto static float DiffAngle(float angle1, float angle2) | Return relative difference between angles | more… |
static int Factorial(int val) | values above '12' will cause int overflow | more… |
proto static float Floor(float f) | Returns floor of value | more… |
proto static int GetNthBitSet(int value, int n) | returns the the index of n-th bit set in a bit mask counting from the right, for instance, in a mask ..0110 1000 , the 0th set bit(right-most bit set to 1) is at 3th position(starting at 0), 1st bit is at 5th position, 2nd bit is at 6th position etc.. | |
proto static int GetNumberOfSetBits(int i) | returns the number of bits set in a bitmask i | |
proto static float HypotenuseOfRightTriangle(float s, float a) | Returns hypotenus of a right triangle | more… |
proto static float InverseLerp(float a, float b, float value) | Calculates the linear value that produces the interpolant value within the range [a, b], it's an inverse of Lerp. | more… |
proto static bool IsInRange(float v, float min, float max) | Returns if value is between min and max (inclusive) | more… |
proto static bool IsInRangeInt(int v, int min, int max) | Returns if value is between min and max (inclusive) | more… |
proto static bool IsPointInCircle(vector c, float r, vector p) | Returns if point is inside circle | more… |
proto static bool IsPointInRectangle(vector mi, vector ma, vector p) | Returns if point is inside rectangle | more… |
proto static float Lerp(float a, float b, float time) | Linearly interpolates between 'a' and 'b' given 'time'. | more… |
proto static float Log2(float x) | Returns the binary (base-2) logarithm of x. | more… |
private void Math() | ||
proto static float Max(float x, float y) | Returns bigger of two given values | more… |
proto static float Min(float x, float y) | Returns smaller of two given values | more… |
proto static float ModFloat(float x, float y) | Returns the floating-point remainder of x/y rounded towards zero | more… |
proto static float NormalizeAngle(float ang) | Normalizes the angle (0...360) | more… |
static float Poisson(float mean, int occurences) | occurences values above '12' will cause Factorial to overflow int. | more… |
proto static float Pow(float v, float power) | Return power of v ^ power | more… |
static bool RandomBool() | Returns a random bool . | more… |
proto static float RandomFloat(float min, float max) | Returns a random float number between and min[inclusive] and max[exclusive]. | more… |
static float RandomFloat01() | Returns a random float number between and min [inclusive] and max [inclusive]. | more… |
static float RandomFloatInclusive(float min, float max) | Returns a random float number between and min [inclusive] and max [inclusive]. | more… |
proto static int RandomInt(int min, int max) | Returns a random int number between and min [inclusive] and max [exclusive]. | more… |
static int RandomIntInclusive(int min, int max) | Returns a random int number between and min [inclusive] and max [inclusive]. | more… |
proto static int Randomize(int seed) | Sets the seed for the random number generator. | more… |
proto static float RemainderFloat(float x, float y) | Returns the floating-point remainder of x/y rounded to nearest | more… |
static float Remap(float inputMin, float inputMax, float outputMin, float outputMax, float inputValue, bool clampedOutput = true) | Returns given value remaped from input range into output range | more… |
proto static float Round(float f) | Returns mathematical round of value | more… |
proto static float SignFloat(float f) | Returns sign of given value | more… |
proto static int SignInt(int i) | Returns sign of given value | more… |
proto static float Sin(float angle) | Returns sinus of angle in radians | more… |
proto static float SmoothCD(float val, float target, inout float velocity[], float smoothTime, float maxVelocity, float dt) | Does the CD smoothing function - easy in | easy out / S shaped smoothing | more… |
static float SmoothCDPI2PI(float val, float target, inout float velocity[], float smoothTime, float maxVelocity, float dt) | more… | |
proto static float SqrFloat(float f) | Returns squared value | more… |
proto static int SqrInt(int i) | Returns squared value | more… |
proto static float Sqrt(float val) | Returns square root | more… |
proto static float Tan(float angle) | Returns tangent of angle in radians | more… |
static bool VectorIsEqual(vector v1, vector v2, float tolerance) | Returns if given vectors are equal with given tolerance | more… |
proto static float WrapFloat(float f, float min, float max) | Returns wrap number to specified interval [min, max[ | more… |
proto static float WrapFloat0X(float f, float max) | Returns wrap number to specified interval [0, max[ | more… |
proto static float WrapFloat0XInclusive(float f, float max) | Returns wrap number to specified interval, inclusive [0, max] | more… |
proto static float WrapFloatInclusive(float f, float min, float max) | Returns wrap number to specified interval, inclusive [min, max] | more… |
proto static int WrapInt(int i, int min, int max) | Returns wrap number to specified interval [min, max[ | more… |
proto static int WrapInt0X(int i, int max) | Returns wrap number to specified interval [0, max[ | more… |
Variables
static const float DEG2RAD = 0.01745329251994329577 | ||
static const float EULER = 2.7182818284590452353 | ||
static const float PI = 3.14159265358979 | ||
static const float PI_HALF = 1.570796326794 | ||
static const float PI2 = 6.28318530717958 | ||
static const float RAD2DEG = 57.2957795130823208768 |
Function Documentation
AbsFloatMath
Returns absolute value
ffloatValue
Returns: float - Absolute value
Print( Math.AbsFloat(-12.5) );
>> 12.5AbsIntMath
Returns absolute value
iintValue
Returns: int - Absolute value
Print( Math.AbsInt(-12) );
>> 12Show 19 more
, CarHud.RefreshVehicleHud(), CarScript.CheckContactCache(), DayZPlayerImplement.HandleView(), HealthMdfr.OnTick(), IngameHud.DisplayNotifier(), MapNavigationBehaviour.OrderedPositionNumbersFromGridCoords(), PlayerAgentPool.RemoteGrowRequestDebug(), PlayerBase.CanChangeStance(), PlayerBase.GetBrokenLegs(), PlayerBase.UpdateCorpseState(), PlayerBase.UpdateCorpseStateVisual(), PluginDeveloperSync.ActivateModifier(), PluginDeveloperSync.DeactivateModifier(), PluginDeveloperSync.IsModifierLocked(), PluginDeveloperSync.LockModifier(), PluginDeveloperSync.RequestDetailedInfo(), SoftSkillsManager.AddExponentialPrecise(), SoftSkillsManager.AddExponentialRough(), and ZombieBase.HandleOrientation()AcosMath
Returns angle in radians from cosinus
cfloatCosinus
Returns: float - Angle in radians
Print( Math.Acos(0.707107) ); // (cosinus 45)
>> 0.785398Show 17 more
, ActionPlaceOvenIndoor.ActionCondition(), DayZAnimal.ComputeHitDirectionAngleDeg(), DayZPlayerImplement.EvaluateDamageHitAnimation(), DayZPlayerImplement.EvaluateDeathAnimation(), DayZPlayerImplementMeleeCombat.IsEntityBehindEntityInAngle(), EffectArea.PlaceParticles(), Fence.IsFacingCamera(), Fence.IsFacingPlayer(), FireplaceBase.OnAttachmentRuined(), MiscGameplayFunctions.DropAllItemsInInventoryInBounds(), MiscGameplayFunctions.IsPlayerOrientedTowardPos(), ShelterSite.IsFacingCamera(), TerritoryFlag.IsFacingCamera(), TerritoryFlag.IsFacingPlayer(), Weapon_Base.LiftWeaponCheckEx(), ZombieBase.ComputeHitDirectionAngle(), and ZombieBase.ComputeHitDirectionAngleEx()AreaOfRightTriangleMath
Returns area of a right triangle
sfloatLength of adjacent legafloatAngle of corner bordering adjacent which is not the right corner (in radians)
Returns: float - Area
AsinMath
Returns angle in radians from sinus
sfloatSinus
Returns: float - Angle in radians
Print( Math.Asin(0.707107) ); // (sinus 45)
>> 0.785398AtanMath
Returns angle in radians from tangent
xfloatTangent
Returns: float - Angle in radians
Atan2Math
Returns angle in radians from tangent
yfloatTangentxfloatTangent
Returns: float - Angle in radians
Print ( Math.Atan2(1, 1) );
>> 0.785398CeilMath
Returns ceil of value
ffloatValue
Returns: float - Ceil of value
Print( Math.Ceil(5.3) );
Print( Math.Ceil(5.8) );
>> 6
>> 6Show 15 more
, BleedChanceData.CalculateBleedChance(), BookMenu.NextPrevPage(), CAContinuousMineWood.CreateSecondaryItems(), CargoContainer.UpdateRowVisibility(), CatchingContextFishingRodAction.GetSignalMax(), CatchingContextPoissonBase.GetSignalMax(), CutOutSeeds.Do(), EffectArea.FillWithParticles(), FlammableBase.Upgrade(), MapMenu.ProcessDistanceAndUnits(), OutdoorThermometerManager.Add(), OutdoorThermometerManager.Remove(), PlantBase.Init(), ServerBrowserFavoritesTabConsolePages.LoadExtraEntries(), and Slot.SetFertilizerQuantity()ClampMath
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'
valuefloatValueminfloatMinimum valuemaxfloatMaximum value
Returns: float - Clamped value
Print( Math.Clamp(-0.1, 0, 1) );
Print( Math.Clamp(2, 0, 1) );
Print( Math.Clamp(0.5, 0, 1) );
>> 0
>> 1
>> 0.5CosMath
Returns cosinus of angle in radians
anglefloatAngle in radians
Returns: float - Cosinus of angle
Print( Math.Cos(0.785398) ); // (45)
>> 0.707107Show 26 more
, BrightnessTestLight.OnFrameLightSource(), Debug.DrawCone(), Easing.EaseInOutSine(), Easing.EaseInSine(), EffectArea.FillWithParticles(), EffectArea.PlaceParticles(), EntityPlacementCallback.OnSetup(), FireplaceBase.OnAttachmentRuined(), FlareSimulation.FlareParticleUpdate(), HitDirectionEffectArrow.FinalizePositionCalculation(), HitDirectionEffectBase.CalculateArrowPosition(), HitDirectionEffectSpike.FinalizePositionCalculation(), MiscGameplayFunctions.DropAllItemsInInventoryInBounds(), MiscGameplayFunctions.FilterObstructedObjectsByGrouping(), MiscGameplayFunctions.GetHeadingVector(), MiscGameplayFunctions.GetRandomizedPosition(), PartyLight.OnFrameLightSource(), PPERequester_HeavyMetalPoisoning_3.SetEffectProgress(), PPERequester_HMPGhosts.ProcessSimulation(), RadialMenu.Refresh(), Transport.DetectFlippedUsingSurface(), vector.RotateAroundZeroDeg(), vector.RotateAroundZeroRad(), VicinityItemManager.DebugConeDraw(), VicinityItemManager.RefreshVicinityItems(), and ZombieBase.HandleOrientation()DiffAngleMath
Return relative difference between angles
angle1floatangle2float
Returns: float Difference between angles (angle1 - angle2)
Print( Math.DiffAngle(-45, 45) );
Print( Math.DiffAngle(90, 80) );
>> -90
>> 10FloorMath
Returns floor of value
ffloatValue
Returns: float - Floor of value
Print( Math.Floor(5.3) );
Print( Math.Floor(5.8) );
>> 5
>> 5Show 26 more
, Construction.HasMaterials(), Construction.TakeMaterialsServer(), DayZIntroScenePC.CharacterRotate(), EffectArea.FillWithParticles(), FishYieldItemBase.GetCycleTimeForYieldItem(), IngameHudHeatBuffer.SetBaseAlpha(), ItemBase.SplitItem(), ItemBase.SplitItemToInventoryLocation(), Magazine.SplitItem(), Magazine.SplitItemToInventoryLocation(), MapMenu.ProcessDistanceAndUnits(), MiscGameplayFunctions.CreateItemBasePiles(), MiscGameplayFunctions.CreateItemBasePilesDispersed(), MiscGameplayFunctions.CreateMagazinePiles(), MiscGameplayFunctions.CreateMagazinePilesDispersed(), MiscGameplayFunctions.CreateMagazinePilesFromBullet(), MiscGameplayFunctions.Truncate(), MiscGameplayFunctions.TruncateVec(), MissionMainMenu.SortedInsert(), ServerBrowserTabPc.SortedInsertAsc(), ServerBrowserTabPc.SortedInsertDesc(), ServerBrowserTabPc.SortedInsertEx(), StaticConstructionMethods.SpawnConstructionMaterialPiles(), TutorialKeybinds.Rebuild(), VicinitySlotsContainer.ShowItemsInContainers(), and WorldData.CalcBaseEnvironmentTemperature()HypotenuseOfRightTriangleMath
Returns hypotenus of a right triangle
sfloatLength of adjacent legafloatAngle of corner bordering adjacent which is not the right corner (in radians)
Returns: float - hypotenus
InverseLerpMath
Calculates the linear value that produces the interpolant value within the range [a, b], it's an inverse of Lerp.
afloatStartbfloatEndvaluefloatvalue
Returns: float - the time given the position between 'a' and 'b' given 'value', there is no clamp on 'value', to stay between [0..1] use 'value' between 'a' and 'b'
Print( Math.InverseLerp(3, 7, 5) );
>> 0.5IsInRangeMath
Returns if value is between min and max (inclusive)
vfloatValueminfloatMinimum valuemaxfloatMaximum value
Returns: bool - if value is within range [min,max]
Print( Math.IsInRange(6.9, 3.6, 9.3) );
>> trueShow 1 more
, HeatComfortAnimHandler.Process()IsInRangeIntMath
Returns if value is between min and max (inclusive)
vintValueminintMinimum valuemaxintMaximum value
Returns: bool - if value is within range [min,max]
Print( Math.IsInRangeInt(6, 3, 9) );
>> trueIsPointInCircleMath
Returns if point is inside circle
cvectorCenter of circle ([0] and [2] will be used, as a circle is 2D)rfloatRadius of circlepvectorPoint ([0] and [2] will be used, as a circle is 2D)
Returns: bool - True when point is in circle
IsPointInRectangleMath
Returns if point is inside rectangle
mivectorMinimums of rectangle ([0] and [2] will be used, as a rectangle is 2D)mavectorMaximums of rectangle ([0] and [2] will be used, as a rectangle is 2D)pvectorPoint ([0] and [2] will be used, as a rectangle is 2D)
Returns: bool - True when point is in rectangle
LerpMath
Linearly interpolates between 'a' and 'b' given 'time'.
afloatStartbfloatEndtimefloatTime [value needs to be between 0..1 for correct results, no auto clamp applied]
Returns: float - The interpolated result between the two float values.
Print( Math.Lerp(3, 7, 0.5) );
>> 5Log2Math
Returns the binary (base-2) logarithm of x.
xfloatValue whose logarithm is calculated.
Returns: float The binary logarithm of x: log2x.
If x is negative, it causes a domain error:
If x is zero, it may cause a pole error (depending on the library implementation).
Print( Math.Log2(1.0) );
>> 0.0MaxMath
Returns bigger of two given values
xfloatValueyfloatValue
Returns: float - max value
Print( Math.Max(5.3, 2.8) );
>> 5.3MinMath
Returns smaller of two given values
xfloatValueyfloatValue
Returns: float - min value
Print( Math.Min(5.3, 2.8) );
>> 2.8Show 35 more
, BroomBase.CalculateQuantity(), CAContinuousDisinfectPlant.Setup(), CAContinuousFill.Setup(), CAContinuousFillCoolant.Setup(), CAContinuousFillFuel.Setup(), CAContinuousFillPowerGenerator.Setup(), CAContinuousQuantityLiquidTransfer.Setup(), CAContinuousRepeatFishing.SetNewSignalData(), CAContinuousTransferQuantity.Setup(), CAContinuousWaterPlant.Setup(), CAContinuousWaterSlot.Setup(), CargoContainer.AddedToCargoEx(), CargoContainer.RemovedFromCargo(), ComponentEnergyManager.SetEnergy(), DayZGame.GetFOVByZoomType(), FlammableBase.Upgrade(), HudDebugWinCharDebug.Update(), InjuredLegNotfr.DisplayBadge(), Liquid.Transfer(), MissionServer.TickScheduler(), PlayerRestrictedAreaInstance.ValidatePlayerRestrictedAreaPositions(), PluginDayZCreatureAIDebug.OnGUI_AnimEvents(), PPEMatClassParameterBool.Update(), PPEMatClassParameterColor.Update(), PPEMatClassParameterFloat.Update(), PPEMatClassParameterInt.Update(), QuickBarBase.updateSlotsCount(), RadialMenu.GetParentMinSize(), ServerBrowserTabConsolePages.RefreshDummyList(), ServerBrowserTabPc.SortedInsertEx(), StaminaHandler.ApplyExhaustion(), StaminaHandler.CalcStaminaGainBonus(), StaminaHandler.DepleteStaminaEx(), StaminaHandler.ProcessStaminaChanges(), and TemperatureDataInterpolated.InterpolateTemperatureDelta()ModFloatMath
Returns the floating-point remainder of x/y rounded towards zero
xfloatValue of the quotient numeratoryfloatValue of the quotient denominator
Returns: float - The remainder of dividing the arguments
Print( Math.ModFloat(5.3, 2) );
Print( Math.ModFloat(18.5, 4.2) );
>> 1.3
>> 1.7NormalizeAngleMath
Normalizes the angle (0...360)
angfloatAngle for normalizing
Returns: float - Normalized angle
Print( Math.NormalizeAngle(390) );
Print( Math.NormalizeAngle(-90) );
>> 30
>> 270PoissonMath
occurences values above '12' will cause Factorial to overflow int.
PowMath
Return power of v ^ power
vfloatValuepowerfloatPower
Returns: float - The result of raising v to the given power
Print( Math.Pow(2, 4) ); // (2*2*2*2)=16
>> 16Show 30 more
, BleedingSourcesManagerRemote.GetBleedingSourceCountRemote(), CatchingContextTrapsBase.ModifySignalProbability(), CombinationLock.CombinationLock(), DayZIntroScenePC.DayZIntroScenePC(), DisplayElementBase.GetCompareMask(), Easing.EaseInElastic(), Easing.EaseInExpo(), Easing.EaseInOutElastic(), Easing.EaseInOutExpo(), Easing.EaseOutElastic(), Easing.EaseOutExpo(), GardenBase.SetMaxWaterStateVal(), HitDirectionEffectBase.Init(), Poisson(), RandomFloatInclusive(), MiscGameplayFunctions.Truncate(), MiscGameplayFunctions.TruncateVec(), Pistol_Base.GetApproximateMovementOffset(), PlayerStomach.OnStoreLoad(), PluginRecipesManager.ResolveIngredients(), PluginRecipesManager.WalkRecipes(), PluginTransmissionAgents.InjectAgentsWithPlayer(), PluginTransmissionAgents.InjectAgentsWithPlayerCount(), RecipeBase.GetIngredientMaskForItem(), ScriptConsoleConfigTab.Init(), ScriptConsoleConfigTab.OnClick(), ScriptConsoleItemsTab.OnChange(), StaminaHandler.DepleteStaminaEx(), Weapon_Base.GetApproximateMovementOffset(), and WeaponLiftDiag.DrawDiag()RandomBoolMath
static bool RandomBool()Returns a random bool .
Returns: bool - Random bool either 0 or 1
Print( Math.RandomBool() );
Print( Math.RandomBool() );
Print( Math.RandomBool() );
>> true
>> true
>> falseRandomFloatMath
Returns a random float number between and min[inclusive] and max[exclusive].
minfloatRange starts [inclusive]maxfloatRange ends [exclusive]
Returns: float - Random number in range
Print( Math.RandomFloat(0,1) );
Print( Math.RandomFloat(0,2) );
>> 0.597561
>> 1.936456Show 47 more
, Apple.EEOnCECreate(), BBMaterials_Preset.OnPresetSpawn(), BoatScript.EEOnCECreate(), BrainDiseaseMdfr.OnTick(), CameraShake.Update(), Canteen.EEOnCECreate(), CarRadiator.EEKilled(), CarScript.EEOnCECreate(), CarScript.EOnPostSimulate(), ChernarusPlusData.Init(), CutOutSeeds.Do(), DayZGame.CloseCombatEffects(), DeCraftWoodenCrate.Do(), DeveloperTeleport.SetPlayerPosition(), EffBulletImpactBase.CalculateStoppingForce(), EnochData.Init(), FeverBlurSymptom.OnUpdateClient(), FlammableBase.StandUp(), GameInventory.SetGroundPosByOwnerBounds(), GeyserTrigger.RandomizeMouthPos(), GreenBellPepper.EEOnCECreate(), Grenade_Base.ActivateRandomTime(), Hit_MeatBones.BloodSplatGround(), ItemBase.ExplodeAmmo(), KuruShake.KuruShake(), LightDimming.AdvanceState(), MiscEffects.PlayVegetationCollideParticles(), MiscGameplayFunctions.ThrowAllItemsInInventory(), Particle.RandomizeOrientation(), Particle.SetWiggle(), ParticleSource.RandomizeOrientation(), Pear.EEOnCECreate(), PlayerBase.DropItem(), Plum.EEOnCECreate(), Potato.EEOnCECreate(), Raycaster.DoMeasurement(), SakhalData.Init(), SakhalData.WeatherOnBeforeChange(), ScriptedLightBase.HandleDancingShadows(), ScriptedLightBase.HandleFlickering(), StaminaHandler.DepleteStaminaEx(), Tomato.EEOnCECreate(), UnderObjectDecalSpawnComponent.SpawnDecal(), Update117_Preset.OnPresetSpawn(), Update118_Preset.OnPresetSpawn(), WaterBottle.EEOnCECreate(), and Zucchini.EEOnCECreate()RandomFloat01Math
static float RandomFloat01()Returns a random float number between and min [inclusive] and max [inclusive].
Returns: float - Random number in range 0.0 .. 1.0
Print( Math.RandomFloat01() ); // 0.0 .. 1.0
>> 0.3
>> 1.0Show 26 more
, AreaExposureMdfr.OnTick(), BearSteakMeat.HandleFoodStageChangeAgents(), BleedingIndicator.Update(), BleedingSource.CreateParticle(), BleedingSourcesManagerServer.ProcessHit(), BleedingSourcesManagerServer.RemoveBleedingSource(), BrainDiseaseMdfr.OnTick(), CatchingResultBasic.RollChance(), CommonColdMdfr.OnTick(), DayZInfectedType.ChooseAttack(), Edible_Base.ProcessDecay(), GardenBase.CheckRainTick(), HeavyMetalPhase2Mdfr.OnTick(), InfluenzaMdfr.OnTick(), MiscGameplayFunctions.GetRandomizedPosition(), PlantBase.GrowthTimerTick(), PlayerBase.GetBloodyHandsPenaltyAgents(), PlayerBase.ProcessFeetDamageServer(), PlayerBase.ProcessHandDamage(), PlayerBase.SpreadAgentsEx(), PluginHorticulture.GiveWormsToPlayer(), PluginTransmissionAgents.DetermineChanceToTransmit(), PneumoniaMdfr.OnTick(), PoisoningMdfr.OnTick(), UiHintPanel.RandomizePageIndex(), and WolfSteakMeat.HandleFoodStageChangeAgents()RandomFloatInclusiveMath
Returns a random float number between and min [inclusive] and max [inclusive].
minfloatRange starts [inclusive]maxfloatRange ends [inclusive]
Returns: float - Random number in range
Print( Math.RandomFloatInclusive(0, 1) ); // 0.0 .. 1.0
Print( Math.RandomFloatInclusive(1, 2) ); // 1.0 .. 2.0
>> 0.3
>> 2.0RandomIntMath
Returns a random int number between and min [inclusive] and max [exclusive].
minintRange starts [inclusive]maxintRange ends [exclusive]
Returns: int - Random number in range
Print( Math.RandomInt(0, 1) ); // only 0
Print( Math.RandomInt(0, 2) ); // 0 or 1
>> 0
>> 1RandomIntInclusiveMath
Returns a random int number between and min [inclusive] and max [inclusive].
minintRange starts [inclusive]maxintRange ends [inclusive]
Returns: int - Random number in range
Print( Math.RandomIntInclusive(0, 1) ); // 0 or 1
Print( Math.RandomIntInclusive(0, 2) ); // 0, 1, 2
>> 1
>> 2Show 47 more
, AreaDamageBase.GetRaycastedHitZone(), AreaDamageComponentRaycasted.GetFallbackHitZone(), AreaExposureMdfr.BleedingSourceCreateCheck(), BearTrap.OnServerSteppedOn(), CAContinuousMineWood.DamagePlayersHands(), CarScript.OnVehicleJumpOutServer(), ChernarusPlusData.CalculateVolFog(), ChernarusPlusData.CalculateWind(), ChernarusPlusData.WeatherOnBeforeChange(), CholeraMdfr.OnActivate(), CholeraMdfr.OnTick(), CraftBaseBallBatBarbed.Do(), DayZPlayerImplementFallDamage.Randomize(), DayZPlayerMeleeFightLogic_LightHeavy.DamageHands(), DeCraftWoodenCrate.Do(), Edible_Base.ProcessDecay(), EmoteVomit.EmoteStartOverride(), EnochData.CalculateVolFog(), EnochData.CalculateWind(), EnochData.WeatherOnBeforeChange(), FireworksLauncher.FireworksLauncher(), FireworksLauncherClientEvent.GetSecondaryExplosionDelay(), HitDirectionEffectBase.Init(), HitDirectionEffectSplash.SetIndicatorRotation(), HitDirectionImagesBase.RandomizeImageIdx(), HotSpringTrigger.SpawnVaporEffect(), LandMineTrap.OnSteppedOn(), MapNavigationBehaviour.RandomizedDeviation(), RandomBool(), MiscGameplayFunctions.GetRandomizedPosition(), MissionServer.RandomArtillery(), OpenItem.OpenAndSwitch(), PrepareChicken.Do(), PrepareFox.Do(), PrepareRabbit.Do(), SakhalData.CalculateWind(), SakhalData.WeatherOnBeforeChange(), SpookyTriggerEventsHandler.SelectEvent(), ToxicityMdfr.OnTick(), UiHintPanel.RandomizePageIndex(), VolcanicTrigger.SpawnVaporEffect(), Weapon_Base.FillChamber(), Weapon_Base.FillInnerMagazine(), Weapon_Base.SpawnAttachedMagazine(), Wreck_SantasSleigh.RandomizePosition(), Wreck_SantasSleigh.SpawnRandomDeers(), and ZombieBase.HandleDamageHit()RandomizeMath
Sets the seed for the random number generator.
seedintNew seed for the random number generator, -1 will use time
Returns: int - Returns new seed
Print( Math.Randomize(5) );
>> 5Show 8 more
, DayZGame.OnAfterCreate(), DayZInfectedType.ChooseAttack(), DayZPlayerImplementFallDamage.AttachBleedingToZonesByHeight(), DayZPlayerImplementFallDamage.Randomize(), FireworksLauncher.OnVariablesSynchronized(), KuruShake.KuruShake(), MapNavigationBehaviour.RandomizedDeviation(), and UiHintPanel.RandomizePageIndex()RemainderFloatMath
Returns the floating-point remainder of x/y rounded to nearest
xfloatValue of the quotient numeratoryfloatValue of the quotient denominator
Returns: float - The remainder of dividing the arguments
Print( Math.RemainderFloat(5.3, 2) );
Print( Math.RemainderFloat(18.5, 4.2) );
>> -0.7
>> 1.7RemapMath
static float Remap(float inputMin, float inputMax, float outputMin, float outputMax, float inputValue, bool clampedOutput = true)Returns given value remaped from input range into output range
inputMinfloatMinimal value of given input rangeinputMaxfloatMaximal value of given input rangeoutputMinfloatMinimal value of given output rangeoutputMaxfloatMaximal value of given output rangeinputValuefloatValue we want to remapclampedOutputboolIf value should stay in that range, otherwise it will be extrapolated
Returns: float - Remapped value
RoundMath
Returns mathematical round of value
ffloatValue
Returns: float - closest whole number to 'f'
Print( Math.Round(5.3) );
Print( Math.Round(5.8) );
>> 5
>> 6SignFloatMath
Returns sign of given value
ffloatValue
Returns: float - Sign of given value
Print( Math.SignFloat(-12.0) );
Print( Math.SignFloat(0.0) );
Print( Math.SignFloat(12.0) );
>> -1.0
>> 0
>> 1.0SignIntMath
Returns sign of given value
iintValue
Returns: int - Sign of given value
Print( Math.SignInt(-12) );
Print( Math.SignInt(0) );
Print( Math.SignInt(12) );
>> -1
>> 0
>> 1SinMath
Returns sinus of angle in radians
anglefloatAngle in radians
Returns: float - Sinus of angle
Print( Math.Sin(0.785398) ); // (45)
>> 0.707107Show 36 more
, BleedingIndicatorDropData.ScatterPosition(), DayZPlayerCameraIronsights.OnUpdate(), DayZPlayerImplementAiming.ApplyBreathingPattern(), Debug.DrawCone(), Easing.EaseInElastic(), Easing.EaseInOutElastic(), Easing.EaseOutElastic(), Easing.EaseOutSine(), EffectArea.FillWithParticles(), EffectArea.PlaceParticles(), EntityPlacementCallback.OnSetup(), FeverBlurSymptom.OnUpdateClient(), FireplaceBase.OnAttachmentRuined(), FlareSimulation.FlareParticleUpdate(), HitDirectionEffectArrow.FinalizePositionCalculation(), HitDirectionEffectBase.CalculateArrowPosition(), HitDirectionEffectSpike.FinalizePositionCalculation(), MiscGameplayFunctions.Bobbing(), MiscGameplayFunctions.DropAllItemsInInventoryInBounds(), MiscGameplayFunctions.FilterObstructedObjectsByGrouping(), MiscGameplayFunctions.GetHeadingVector(), MiscGameplayFunctions.GetRandomizedPosition(), PartyLight.OnFrameLightSource(), PlayerBase.OnUnconsciousUpdate(), PPERequester_Drowning.OnUpdate(), PPERequester_HeavyMetalPoisoning_3.SetEffectProgress(), PPERequester_HMPGhosts.ProcessSimulation(), PPERequester_HMPGhosts.ReSampleChannels(), PPERequester_HMPGhosts.SampleChannels(), RadialMenu.Refresh(), ScriptedLightBase.HandleBlinking(), vector.RotateAroundZeroDeg(), vector.RotateAroundZeroRad(), VicinityItemManager.DebugConeDraw(), VicinityItemManager.RefreshVicinityItems(), and ZombieBase.HandleOrientation()SmoothCDMath
proto static float SmoothCD(float val, float target, inout float velocity[], float smoothTime, float maxVelocity, float dt)Does the CD smoothing function - easy in | easy out / S shaped smoothing
valactualvaluetargetvaluewe are reaching for -> Targetvelocityfloat[1]- array of ONE member - some kind of memory and actual accel/decel rate, need to be zeroed when filter is about to be resetsmoothTimesmoothingparameter, 0.1 .. 0.4 are resonable values, 0.1 is sharp, 0.4 is very smoothmaxVelocitymaximalvalue change when multiplied by dtdtdeltatime
Returns: float smoothed/filtered value
val = EnfMath.SmoothCD(val, varTarget, valVelocity, 0.3, 1000, dt);Show 17 more
, DayZPlayerCamera3rdPersonProneBase.OnUpdate(), DayZPlayerCamera3rdPersonProneBase.UpdateLRAngleLookAt(), DayZPlayerCamera3rdPersonVehicle.OnUpdate(), DayZPlayerCameraBase.StdFovUpdate(), DayZPlayerCameraBase.UpdateLRAngle(), DayZPlayerCameraBase.UpdateLRAngleUnlocked(), DayZPlayerCameraBase.UpdateUDAngle(), DayZPlayerCameraBase.UpdateUDAngleUnlocked(), DayZPlayerCameraIronsights.HoldBreathFOVEffect(), DayZPlayerCameraIronsights.OnUpdate(), DayZPlayerCameraOptics.HoldBreathFOVEffect(), DayZPlayerImplement.HandleWeapons(), DayZPlayerImplementAiming.ApplyHorizontalNoise(), DayZPlayerImplementAiming.ProcessStealthFilters(), HitDirectionEffectBase.CalculateArrowPosition(), SmoothCDPI2PI(), and NotificationUI.Update()SmoothCDPI2PIMath
static float SmoothCDPI2PI(float val, float target, inout float velocity[], float smoothTime, float maxVelocity, float dt)SqrFloatMath
Returns squared value
ffloatValue
Returns: float - Squared value
Print( Math.SqrFloat(12.5) );
>> 156.25Show 10 more
, DayZPlayerMeleeFightLogic_LightHeavy.GetAttackTypeByDistanceToTarget(), Environment.GatherTemperatureSources(), ExplosivesBase.OnCEUpdate(), FlashGrenade.OnExplosionEffects(), MeleeTargeting.EvaluateComponentEx(), MeleeTargetSettings.MeleeTargetSettings(), PluginUniversalTemperatureSourceClient.ProcessUniversalTemperatureSources(), RemoteDetonatorTrigger.OnActivatedByItem(), RemoteDetonatorTrigger.OnCEUpdate(), and TrapBase.IsPlaceable()SqrIntMath
Returns squared value
iintValue
Returns: int - Squared value
Print( Math.SqrInt(12) );
>> 144SqrtMath
Returns square root
valfloatValue
Returns: float - Square of value
Print( Math.Sqrt(25));
>> 5TanMath
Returns tangent of angle in radians
anglefloatAngle in radians
Returns: float - Tangens of angle
Print( Math.Tan(0.785398) ); // (45)
>> 1VectorIsEqualMath
Returns if given vectors are equal with given tolerance
v1floatFirst vector for comparisonv2floatSecond vector for comparisontolerancefloatRange in which given vectors can differ
Returns: bool - True if Vectors are equal; otherwise false
WrapFloatMath
Returns wrap number to specified interval [min, max[
ffloatValueminfloatMinimummaxfloatMaximum
Returns: float - number in specified interval [min, max[
Print( Math.WrapFloat(9.0, 1.0, 9.0) );
>> 1.0WrapFloat0XMath
Returns wrap number to specified interval [0, max[
ffloatValuemaxfloatMaximum
Returns: float - number in specified interval [0, max[
Print( Math.WrapFloat0X(9.0, 9.0) );
>> 0.0WrapFloat0XInclusiveMath
Returns wrap number to specified interval, inclusive [0, max]
ffloatValuemaxfloatMaximum
Returns: float - number in specified interval [0, max]
Print( Math.WrapFloat0XInclusive(9.0, 9.0) );
>> 9.0WrapFloatInclusiveMath
Returns wrap number to specified interval, inclusive [min, max]
ffloatValueminfloatMinimummaxfloatMaximum
Returns: float - number in specified interval [min, max]
Print( Math.WrapFloatInclusive(9.0, 1.0, 9.0) );
>> 9.0WrapIntMath
Returns wrap number to specified interval [min, max[
iintValueminfloatMinimummaxintMaximum
Returns: int - number in specified interval [min, max[
Print( Math.WrapInt(9, 1, 9) );
>> 1