Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added shoot decal logic and improved decals VFX #232

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Content/Maps/de_shortdust.umap
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/concrete_blacktop_ext_01.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/concrete_blend_blacktop_04.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/concrete_blend_blacktopsand_01.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/concrete_concrete_ext_04_cheap.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/concrete_concrete_ext_07.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/concrete_concrete_ext_12.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/concrete_concrete_floor_02.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/concrete_concretefloor012a.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/concrete_metalwall001b_cheap.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/cs_assault_metalwall001a.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/de_dust_residbwall03.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/de_dust_residbwall03a.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/de_dust_sitebwall05.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/de_dust_sitebwall05c.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/de_dust_sitebwall08.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/de_dust_sitebwall13a.uasset
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/metal_metal_corrugated03a.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/metal_metalbar001c.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/metal_metaldoor001a.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/metal_metaldoor002a.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/metal_metaldoor017a.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/metal_metaldoor018a.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/metal_metaldoor032c.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/metal_metaldoor046a.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/metal_metalfence004a.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/metal_metalgate001a.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/metal_metalgate004a.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/metal_metalgate005a.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/metal_metalgrate013a.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/metal_metalhull003a.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/metal_metalpipe010a.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/metal_metalrail003a.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/metal_metalrail011a.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/metal_urban_metalwall01a_small.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/nature_blend_dirt_concrete_02.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/nature_blend_dirt_concrete_03.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/nature_blend_dirt_concrete_06.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/props_woodcrate003d.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/wallpaper_yellow02.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/wood_infflra.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/wood_milbeams003.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/wood_plywood02.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/wood_plywood_ext_01.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/wood_plywood_ext_02.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/wood_vostok_wood.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/wood_vostok_wood_ceiling.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/wood_wood_ext_01.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/wood_woodbeam001.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/wood_woodbeam001a.uasset
Binary file not shown.
Binary file modified Content/Maps/de_shortdust/wood_woodtrim_ext_01.uasset
Binary file not shown.
Binary file modified Content/Maps/warmup.umap
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Importing/textures/blood.tga
Binary file not shown.
Binary file added Importing/textures/blood1.tga
Binary file not shown.
Binary file added Importing/textures/blood2.tga
Binary file not shown.
Binary file added Importing/textures/blood3.tga
Binary file not shown.
Binary file added Importing/textures/blood4.tga
Binary file not shown.
Binary file added Importing/textures/blood5.tga
Binary file not shown.
Binary file added Importing/textures/blood6.tga
Binary file not shown.
Binary file added Importing/textures/blood7.tga
Binary file not shown.
Binary file added Importing/textures/blood8.tga
Binary file not shown.
Binary file added Importing/textures/blood_drop.tga
Binary file not shown.
Binary file added Importing/textures/blood_gore.tga
Binary file not shown.
Binary file added Importing/textures/blood_puff.tga
Binary file not shown.
Binary file added Importing/textures/bloodstain_001.tga
Binary file not shown.
Binary file added Importing/textures/bloodstain_002.tga
Binary file not shown.
Binary file added Importing/textures/bloodstain_003.tga
Binary file not shown.
Binary file added Importing/textures/bloodstain_003b.tga
Binary file not shown.
Binary file added Importing/textures/bloodstain_101.tga
Binary file not shown.
Binary file added Importing/textures/bloodstain_hand.tga
Binary file not shown.
10 changes: 7 additions & 3 deletions Source/Cloud9/Character/Cloud9Character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,16 @@ float ACloud9Character::InternalTakePointDamage(

let Distance = FVector::DistSquared(DamageCauser->GetActorLocation(), GetActorLocation());
let RangeCoefficient = FMath::Pow(WeaponInfo->RangeModifier, Distance * RangeExponentCoefficient);
log(Display, "[Actor='%s'] Distance=%f RangeCoefficient=%f",
*GetName(), FMath::Sqrt (Distance), RangeCoefficient)

log(Verbose, "[Actor='%s'] Distance=%f RangeCoefficient=%f",
*GetName(),
FMath::Sqrt (Distance),
RangeCoefficient)

Damage *= RangeCoefficient;
}

log(Display, "[Actor='%s'] BoneName=%s ApplyDamage=%f", *GetName(), *BoneName.ToString(), Damage);
log(Verbose, "[Actor='%s'] BoneName=%s ApplyDamage=%f", *GetName(), *BoneName.ToString(), Damage);
return Damage;
}

Expand Down
9 changes: 7 additions & 2 deletions Source/Cloud9/Physicals/Cloud9PhysicalMaterial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@ FVector UCloud9PhysicalMaterial::GetFirearmDecalSize() const { return FirearmDec

FRotator UCloud9PhysicalMaterial::GetFirearmDecalRotation(FVector Normal) const
{
constexpr float DecalVPitch = 90.0f;
constexpr float DecalVRoll = -180.0f;
constexpr float DecalHYaw = 90.0f;
constexpr float DecalHRoll = -90.0;

let RandomRotation = FMath::RandRange(FirearmDecalRotationMin, FirearmDecalRotationMax);
let BaseRotation = Normal.Rotation();
let CorrectiveRotation = FMath::IsNearlyEqual(Normal.Z, 1.0f, 0.1f)
? FRotator{DecalRotationPitchOrRoll, DecalRotationYaw, RandomRotation}
: FRotator{RandomRotation, DecalRotationYaw, DecalRotationPitchOrRoll};
? FRotator{DecalVPitch, RandomRotation, DecalVRoll}
: FRotator{RandomRotation, DecalHYaw, DecalHRoll};
return BaseRotation + CorrectiveRotation;
}
4 changes: 3 additions & 1 deletion Source/Cloud9/Tools/Extensions/UWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ namespace EUWorld
FVector DecalSize;
FVector Location;
FRotator Rotator;
float LifeSpan = 0.0f; // Disabled
float LifeSpan = 20.0f;
float FadeScreenSize = 0.001f;
AActor* Owner = nullptr;
APawn* Instigator = nullptr;

Expand All @@ -82,6 +83,7 @@ namespace EUWorld
{
Decal->SetDecalMaterial(Material);
Decal->SetLifeSpan(LifeSpan);
Decal->SetFadeScreenSize(FadeScreenSize);
Decal->DecalSize = DecalSize;
return Actor;
}
Expand Down
69 changes: 28 additions & 41 deletions Source/Cloud9/Weapon/Classes/Cloud9WeaponFirearm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,15 +395,18 @@ EFirearmFireStatus ACloud9WeaponFirearm::Fire(
FString OwnerName = IsHit and LineHit.Component->GetOwner() != nullptr
? *LineHit.Component->GetOwner()->GetName()
: TEXT("???");
FString PhysicalMaterial = LineHit.PhysMaterial.IsValid() ? *LineHit.PhysMaterial->GetName() : TEXT("???");

log(Display,
"Target='%s' Owner='%s' Start={%s} End={%s} TraceEnd={%s} Hit={%s} ",
"Target='%s' Owner='%s' Material='%s' Start={%s} End={%s} TraceEnd={%s} Hit={%s} Normal={%s}",
*TargetName,
*OwnerName,
*PhysicalMaterial,
*StartLocation.ToString(),
*EndLocation.ToString(),
*LineHit.TraceEnd.ToString(),
*LineHit.Location.ToString()
*LineHit.Location.ToString(),
*LineHit.Normal.ToString()
);
}

Expand Down Expand Up @@ -448,50 +451,34 @@ EFirearmFireStatus ACloud9WeaponFirearm::Fire(
Damage * FirearmCommonData.ImpulseMultiplier,
FirearmCommonData.MinAppliedImpulse,
FirearmCommonData.MaxAppliedImpulse);
log(Display, "[Weapon='%s'] Damage=%f Impulse=%f", *GetName(), Damage, Impulse);
log(Verbose, "[Weapon='%s'] Damage=%f Impulse=%f", *GetName(), Damage, Impulse);
Target->AddImpulseAtLocation(Direction * Impulse, LineHit.Location, LineHit.BoneName);
}

let PhysicalMaterial = Cast<UCloud9PhysicalMaterial>(LineHit.PhysMaterial);

if (not IsValid(PhysicalMaterial))
{
log(
Warning,
"[Weapon='%s'] Invalid physical material for target '%s'",
*GetName(),
*DamagedActor->GetName()
);

return EFirearmFireStatus::Success;
}

log(Error, "Normal=%s Rotation=%s",
*LineHit.Normal.ToString(),
*LineHit.Normal.Rotation().ToString()
);

if (let FirearmSquib = PhysicalMaterial->GetRandomFirearmSquib(); IsValid(FirearmSquib))
if (let PhysicalMaterial = Cast<UCloud9PhysicalMaterial>(LineHit.PhysMaterial); IsValid(PhysicalMaterial))
{
UNiagaraFunctionLibrary::SpawnSystemAtLocation(
GetWorld(),
FirearmSquib,
LineHit.Location,
LineHit.Normal.Rotation(),
FVector::OneVector,
true);
}
if (let FirearmSquib = PhysicalMaterial->GetRandomFirearmSquib(); IsValid(FirearmSquib))
{
UNiagaraFunctionLibrary::SpawnSystemAtLocation(
GetWorld(),
FirearmSquib,
LineHit.Location,
LineHit.Normal.Rotation(),
FVector::OneVector,
true);
}

if (let FirearmDecalMaterial = PhysicalMaterial->GetRandomFirearmDecal(); IsValid(FirearmDecalMaterial))
{
GetWorld() | EUWorld::SpawnDecal{
.Material = FirearmDecalMaterial,
.DecalSize = PhysicalMaterial->GetFirearmDecalSize(),
.Location = LineHit.Location,
.Rotator = PhysicalMaterial->GetFirearmDecalRotation(LineHit.Normal),
.Owner = DamagedActor,
.Instigator = Character
};
if (let FirearmDecalMaterial = PhysicalMaterial->GetRandomFirearmDecal(); IsValid(FirearmDecalMaterial))
{
GetWorld() | EUWorld::SpawnDecal{
.Material = FirearmDecalMaterial,
.DecalSize = PhysicalMaterial->GetFirearmDecalSize(),
.Location = LineHit.Location,
.Rotator = PhysicalMaterial->GetFirearmDecalRotation(LineHit.Normal),
.Owner = DamagedActor,
.Instigator = Character
};
}
}
}

Expand Down