From af6a6b4ce63cc5ce40de556a1ae40638467943db Mon Sep 17 00:00:00 2001 From: Alexei Gladkikh Date: Fri, 10 May 2024 12:32:55 +0300 Subject: [PATCH] #284 Added decal size randomization (#285) --- Source/Cloud9/Physicals/Cloud9PhysicalMaterial.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/Cloud9/Physicals/Cloud9PhysicalMaterial.cpp b/Source/Cloud9/Physicals/Cloud9PhysicalMaterial.cpp index edb191570..9f349d528 100644 --- a/Source/Cloud9/Physicals/Cloud9PhysicalMaterial.cpp +++ b/Source/Cloud9/Physicals/Cloud9PhysicalMaterial.cpp @@ -1,10 +1,12 @@ -// Copyright (c) 2024 Alexei Gladkikh +// Copyright (c) 2024 Alexei Gladkikh #include "Cloud9PhysicalMaterial.h" UCloud9PhysicalMaterial::UCloud9PhysicalMaterial() { FirearmDecalSize = {8.0f, 8.0, 8.0f}; + FirearmDecalScaleMin = 1.0f; + FirearmDecalScaleMax = 1.0f; FirearmDecalRotationMin = 0.0f; FirearmDecalRotationMax = 180.0f; @@ -28,7 +30,11 @@ bool IsVertical(FVector Normal) UMaterialInterface* UCloud9PhysicalMaterial::GetRandomFirearmDecal() const { return GetRandomItem(FirearmDecals); } -FVector UCloud9PhysicalMaterial::GetFirearmDecalSize() const { return FirearmDecalSize; } +FVector UCloud9PhysicalMaterial::GetFirearmDecalSize() const +{ + let RandomScale = FMath::RandRange(FirearmDecalScaleMin, FirearmDecalScaleMax); + return FirearmDecalSize * RandomScale; +} FRotator UCloud9PhysicalMaterial::GetFirearmDecalRotation(FVector Normal) const {