From cd8f414b037ae6e8a3d70a4b9db981dd972ba990 Mon Sep 17 00:00:00 2001 From: MH261677 Date: Tue, 19 Mar 2024 13:51:30 +0000 Subject: [PATCH] Fixed extended mag attachement code not working --- .../Content/StarterContent/Shapes/TempExtendedMag.uasset | 3 +++ .../EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp | 7 ++++--- .../Workbench&Attachments/ExtendedMagAttachmentClass.cpp | 2 -- 3 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 EndlessVendetta/Content/StarterContent/Shapes/TempExtendedMag.uasset diff --git a/EndlessVendetta/Content/StarterContent/Shapes/TempExtendedMag.uasset b/EndlessVendetta/Content/StarterContent/Shapes/TempExtendedMag.uasset new file mode 100644 index 00000000..ab1b9cd1 --- /dev/null +++ b/EndlessVendetta/Content/StarterContent/Shapes/TempExtendedMag.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dad1cb27145affe784da5f1db42f9979fd90bec8ab16c70049273f58cabfb210 +size 47919 diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp index 8609bbc9..dc15bb2e 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp @@ -13,6 +13,7 @@ #include #include "EndlessVendetta/BountySystem/ControlsTraining/TargetDummy.h" +#include "EndlessVendetta/Workbench&Attachments/ExtendedMagAttachmentClass.h" #include "EndlessVendetta/Workbench&Attachments/SilencerAttachmentClass.h" @@ -319,7 +320,7 @@ void ABaseWeaponClass::SetupExtendedMagAttachment(UStaticMesh* ExtendedMagMesh) GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Red, TEXT("SETTING UP EXTENDEDMAG ATTACHMENTS")); FTransform EmptyTransform; - USceneComponent* ExtendedMagAttachmentClass = Cast(AddComponentByClass(USilencerAttachmentClass::StaticClass(), false, EmptyTransform, false)); + USceneComponent* ExtendedMagAttachmentClass = Cast(AddComponentByClass(UExtendedMagAttachmentClass::StaticClass(), false, EmptyTransform, false)); ExtendedMagAttachmentClass->ComponentTags.Add(FName("AttachmentType")); USkeletalMeshComponent* WeaponSkeletonMesh = FindComponentByClass(); if (IsValid(ExtendedMagAttachmentClass)) @@ -327,7 +328,7 @@ void ABaseWeaponClass::SetupExtendedMagAttachment(UStaticMesh* ExtendedMagMesh) if (IsValid(WeaponSkeletonMesh)) { //this handles giving the weapon the required component class/code - ExtendedMagAttachmentClass->AttachToComponent(WeaponSkeletonMesh, FAttachmentTransformRules::SnapToTargetIncludingScale, FName(TEXT("SilencerMeshSocket"))); + ExtendedMagAttachmentClass->AttachToComponent(WeaponSkeletonMesh, FAttachmentTransformRules::SnapToTargetIncludingScale, FName(TEXT("ExtendedMagSocket"))); UE_LOG(LogTemp, Display, TEXT("All Attachment is valid")); //this makes it showup in editor for better debugging ExtendedMagAttachmentClass->CreationMethod = EComponentCreationMethod::Instance; @@ -338,7 +339,7 @@ void ABaseWeaponClass::SetupExtendedMagAttachment(UStaticMesh* ExtendedMagMesh) { StaticMeshComp->AttachToComponent(ExtendedMagAttachmentClass, FAttachmentTransformRules::SnapToTargetIncludingScale); StaticMeshComp->SetStaticMesh(ExtendedMagMesh); - StaticMeshComp->SetRelativeRotation(FRotator(0, 90, 0)); + StaticMeshComp->SetRelativeRotation(FRotator(0, 180, 0)); StaticMeshComp->SetCollisionEnabled(ECollisionEnabled::NoCollision); //Making it show in editor for debugging StaticMeshComp->CreationMethod = EComponentCreationMethod::Instance; diff --git a/EndlessVendetta/Source/EndlessVendetta/Workbench&Attachments/ExtendedMagAttachmentClass.cpp b/EndlessVendetta/Source/EndlessVendetta/Workbench&Attachments/ExtendedMagAttachmentClass.cpp index ea2321ae..a571842b 100644 --- a/EndlessVendetta/Source/EndlessVendetta/Workbench&Attachments/ExtendedMagAttachmentClass.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/Workbench&Attachments/ExtendedMagAttachmentClass.cpp @@ -29,7 +29,5 @@ void UExtendedMagAttachmentClass::BeginPlay() void UExtendedMagAttachmentClass::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) { Super::TickComponent(DeltaTime, TickType, ThisTickFunction); - - // ... }