Reworked Attachment spawning code to be more universal
This commit is contained in:
parent
3990cefbc0
commit
9329454318
@ -9,6 +9,13 @@
|
|||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="8acc2658-cb31-4c49-857f-282cfee74640" name="Changes" comment="">
|
<list default="true" id="8acc2658-cb31-4c49-857f-282cfee74640" name="Changes" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.EndlessVendetta/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.EndlessVendetta/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/.idea.EndlessVendetta/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.EndlessVendetta/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Content/FPWeapon/Mesh/SK_FPGun_Skeleton.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/FPWeapon/Mesh/SK_FPGun_Skeleton.uasset" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_ARTEST1.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_ARTEST1.uasset" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Content/StarterContent/Shapes/TempSilencer.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/StarterContent/Shapes/TempSilencer.uasset" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Content/__ExternalActors__/Levels/DoorTestLevel/9/PG/AISD2CY0WTWKV1BJDYTYJ3.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/__ExternalActors__/Levels/DoorTestLevel/9/PG/AISD2CY0WTWKV1BJDYTYJ3.uasset" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/Workbench&Attachments/SilencerAttachmentClass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/Workbench&Attachments/SilencerAttachmentClass.cpp" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@ -30,28 +37,28 @@
|
|||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent"><![CDATA[{
|
<component name="PropertiesComponent">{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"C++ Project.EndlessVendetta.executor": "Run",
|
"C++ Project.EndlessVendetta.executor": "Run",
|
||||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"git-widget-placeholder": "dev",
|
"git-widget-placeholder": "attachment-bug-fix",
|
||||||
"ignore.virus.scanning.warn.message": "true",
|
"ignore.virus.scanning.warn.message": "true",
|
||||||
"node.js.detected.package.eslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
"node.js.detected.package.tslint": "true",
|
"node.js.detected.package.tslint": "true",
|
||||||
"node.js.selected.package.eslint": "(autodetect)",
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
"node.js.selected.package.tslint": "(autodetect)",
|
"node.js.selected.package.tslint": "(autodetect)",
|
||||||
"nodejs_package_manager_path": "npm",
|
"nodejs_package_manager_path": "npm",
|
||||||
"vue.rearranger.settings.migration": "true"
|
"vue.rearranger.settings.migration": "true"
|
||||||
},
|
},
|
||||||
"keyToStringList": {
|
"keyToStringList": {
|
||||||
"rider.external.source.directories": [
|
"rider.external.source.directories": [
|
||||||
"C:\\Users\\mhara\\AppData\\Roaming\\JetBrains\\Rider2023.3\\resharper-host\\DecompilerCache",
|
"C:\\Users\\mhara\\AppData\\Roaming\\JetBrains\\Rider2023.3\\resharper-host\\DecompilerCache",
|
||||||
"C:\\Users\\mhara\\AppData\\Roaming\\JetBrains\\Rider2023.3\\resharper-host\\SourcesCache",
|
"C:\\Users\\mhara\\AppData\\Roaming\\JetBrains\\Rider2023.3\\resharper-host\\SourcesCache",
|
||||||
"C:\\Users\\mhara\\AppData\\Local\\Symbols\\src"
|
"C:\\Users\\mhara\\AppData\\Local\\Symbols\\src"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}]]></component>
|
}</component>
|
||||||
<component name="RunManager">
|
<component name="RunManager">
|
||||||
<configuration name="EndlessVendetta" type="CppProject" factoryName="C++ Project">
|
<configuration name="EndlessVendetta" type="CppProject" factoryName="C++ Project">
|
||||||
<configuration_1>
|
<configuration_1>
|
||||||
@ -127,6 +134,9 @@
|
|||||||
<workItem from="1705756768038" duration="3821000" />
|
<workItem from="1705756768038" duration="3821000" />
|
||||||
<workItem from="1705856571902" duration="3954000" />
|
<workItem from="1705856571902" duration="3954000" />
|
||||||
<workItem from="1706110241756" duration="1092000" />
|
<workItem from="1706110241756" duration="1092000" />
|
||||||
|
<workItem from="1706705451486" duration="5218000" />
|
||||||
|
<workItem from="1706727398145" duration="597000" />
|
||||||
|
<workItem from="1706790490396" duration="6139000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:e1a0785430701e8ad4da18841226e2e18dd72d825c6a10cf28e7d73f1216ed28
|
oid sha256:8924c723b3b8eaf0a1a580f215de2a547d9118851c617ad590199910fa2f48c9
|
||||||
size 9013
|
size 9020
|
||||||
|
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_ARTEST1.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_ARTEST1.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset
(Stored with Git LFS)
Binary file not shown.
@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:61c0b03ac13ff095d5e52f5551a54cadb54e669e33e5a6a1ee4f8e4e233e50f2
|
oid sha256:cb6b37e3900f88fd3a4a94643d255ddb765f6cacefc1b8adc92c5fb97e7393a8
|
||||||
size 26923
|
size 28238
|
||||||
|
BIN
EndlessVendetta/Content/__ExternalActors__/Levels/DoorTestLevel/9/PG/AISD2CY0WTWKV1BJDYTYJ3.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/__ExternalActors__/Levels/DoorTestLevel/9/PG/AISD2CY0WTWKV1BJDYTYJ3.uasset
(Stored with Git LFS)
Binary file not shown.
@ -258,19 +258,28 @@ void ABaseWeaponClass::InteractPrompt()
|
|||||||
void ABaseWeaponClass::SetupSilencerAttachment(UStaticMesh* SilencerMesh)
|
void ABaseWeaponClass::SetupSilencerAttachment(UStaticMesh* SilencerMesh)
|
||||||
{
|
{
|
||||||
GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Red, TEXT("SETTING UP SILENCER ATTACHMENTS"));
|
GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Red, TEXT("SETTING UP SILENCER ATTACHMENTS"));
|
||||||
FTransform emptytransform;
|
FTransform EmptyTransform;
|
||||||
UActorComponent* SilencerComponent = AddComponentByClass(USilencerAttachmentClass::StaticClass(), true, emptytransform, false);
|
|
||||||
UStaticMeshComponent* SilencerMeshComponent = Cast<UStaticMeshComponent>(AddComponentByClass(UStaticMeshComponent::StaticClass(), true, emptytransform, false));
|
|
||||||
SilencerMeshComponent->SetStaticMesh(SilencerMesh);
|
|
||||||
SilencerMeshComponent->AttachToComponent(Cast<USceneComponent>(GetComponentByClass(USkeletalMeshComponent::StaticClass())), FAttachmentTransformRules::SnapToTargetIncludingScale, FName(TEXT("SilencerMeshSocket")));
|
|
||||||
Cast<USilencerAttachmentClass>(SilencerComponent)->AttachToComponent(SilencerMeshComponent, FAttachmentTransformRules::SnapToTargetIncludingScale);
|
|
||||||
FTransform SilencerSocketTransform = SilencerMeshComponent->GetSocketTransform(FName(TEXT("SilencerMeshSocket")), RTS_Component);
|
|
||||||
FRotator SilencerSocketRotation = SilencerMeshComponent->GetSocketRotation(FName(TEXT("SilencerMeshSocket")));
|
|
||||||
SilencerMeshComponent->SetRelativeTransform(SilencerSocketTransform);
|
|
||||||
SilencerMeshComponent->SetRelativeRotation(this->GetActorRotation());
|
|
||||||
|
|
||||||
|
USceneComponent* SilencerAttachmentClass = Cast<USceneComponent>(AddComponentByClass(USilencerAttachmentClass::StaticClass(), false, EmptyTransform, false));
|
||||||
|
USkeletalMeshComponent* WeaponSkeletonMesh = FindComponentByClass<USkeletalMeshComponent>();
|
||||||
|
if (IsValid(SilencerAttachmentClass))
|
||||||
|
{
|
||||||
|
if (IsValid(WeaponSkeletonMesh))
|
||||||
|
{
|
||||||
|
SilencerAttachmentClass->AttachToComponent(WeaponSkeletonMesh, FAttachmentTransformRules::SnapToTargetIncludingScale, FName(TEXT("SilencerSocketMesh")));
|
||||||
|
UE_LOG(LogTemp, Display, TEXT("All Attachment is valid"));
|
||||||
|
//this makes it showup in editor for better debugging
|
||||||
|
SilencerAttachmentClass->CreationMethod = EComponentCreationMethod::Instance;
|
||||||
|
SilencerAttachmentClass->RegisterComponent();
|
||||||
|
UStaticMeshComponent* StaticMeshComp = NewObject<UStaticMeshComponent>(SilencerAttachmentClass, UStaticMeshComponent::StaticClass());
|
||||||
|
if (IsValid(StaticMeshComp))
|
||||||
|
{
|
||||||
|
StaticMeshComp->AttachToComponent(SilencerAttachmentClass, FAttachmentTransformRules::SnapToTargetIncludingScale);
|
||||||
|
StaticMeshComp->SetStaticMesh(SilencerMesh);
|
||||||
|
StaticMeshComp->CreationMethod = EComponentCreationMethod::Instance;
|
||||||
|
StaticMeshComp->RegisterComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -29,7 +29,5 @@ void USilencerAttachmentClass::BeginPlay()
|
|||||||
void USilencerAttachmentClass::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
|
void USilencerAttachmentClass::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
|
||||||
{
|
{
|
||||||
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
|
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
|
||||||
|
|
||||||
// ...
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user