Fixed extended mag attachement code not working
This commit is contained in:
parent
dd4cb95d1c
commit
cd8f414b03
BIN
EndlessVendetta/Content/StarterContent/Shapes/TempExtendedMag.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/StarterContent/Shapes/TempExtendedMag.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -13,6 +13,7 @@
|
||||
#include <EndlessVendetta/EndlessVendettaGameMode.h>
|
||||
|
||||
#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<USceneComponent>(AddComponentByClass(USilencerAttachmentClass::StaticClass(), false, EmptyTransform, false));
|
||||
USceneComponent* ExtendedMagAttachmentClass = Cast<USceneComponent>(AddComponentByClass(UExtendedMagAttachmentClass::StaticClass(), false, EmptyTransform, false));
|
||||
ExtendedMagAttachmentClass->ComponentTags.Add(FName("AttachmentType"));
|
||||
USkeletalMeshComponent* WeaponSkeletonMesh = FindComponentByClass<USkeletalMeshComponent>();
|
||||
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;
|
||||
|
@ -29,7 +29,5 @@ void UExtendedMagAttachmentClass::BeginPlay()
|
||||
void UExtendedMagAttachmentClass::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
|
||||
{
|
||||
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
|
||||
|
||||
// ...
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user