From 1e3baeb391c2515efa764b8b3934d53c26ec7165 Mon Sep 17 00:00:00 2001 From: TjgL Date: Sat, 1 Feb 2025 10:51:17 +0100 Subject: [PATCH] Slightly improved bullet trails fx --- Content/Legumix/Weapon/Ammo/BP_Tracer.uasset | 4 ++-- Content/Legumix/Weapon/Ammo/C_Jitter.uasset | 3 +++ Content/Legumix/Weapon/Ammo/FXE_ShotGun_Trail.uasset | 4 ++-- Content/Legumix/Weapon/Revolver/BP_Revolver.uasset | 4 ++-- Content/Legumix/Weapon/Shotgun/BP_Shotgun.uasset | 4 ++-- Source/LegumeMix/Private/Weapon/LMBulletTracer.cpp | 5 ++++- Source/LegumeMix/Private/Weapon/LMWeaponManager.cpp | 3 +-- Source/LegumeMix/Public/Weapon/LMBulletTracer.h | 5 ++++- Source/LegumeMix/Public/Weapon/LMWeaponBase.h | 9 +++------ 9 files changed, 23 insertions(+), 18 deletions(-) create mode 100644 Content/Legumix/Weapon/Ammo/C_Jitter.uasset diff --git a/Content/Legumix/Weapon/Ammo/BP_Tracer.uasset b/Content/Legumix/Weapon/Ammo/BP_Tracer.uasset index 2fb1047..10d8885 100644 --- a/Content/Legumix/Weapon/Ammo/BP_Tracer.uasset +++ b/Content/Legumix/Weapon/Ammo/BP_Tracer.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1e8b34577715d3da608ab11dd0da3163ab575d350f103eb66039d932b29f5461 -size 63433 +oid sha256:dfa3f0af4efb1e6732a8ffa4235697431292e4a8e09211d6484add25c015af3d +size 95427 diff --git a/Content/Legumix/Weapon/Ammo/C_Jitter.uasset b/Content/Legumix/Weapon/Ammo/C_Jitter.uasset new file mode 100644 index 0000000..d8a15c6 --- /dev/null +++ b/Content/Legumix/Weapon/Ammo/C_Jitter.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c3763b7f4914f95eccf8d9b8323c58f0cd888fcb07573dff9dda4dacf1e3356 +size 5023 diff --git a/Content/Legumix/Weapon/Ammo/FXE_ShotGun_Trail.uasset b/Content/Legumix/Weapon/Ammo/FXE_ShotGun_Trail.uasset index a812dc0..b54437d 100644 --- a/Content/Legumix/Weapon/Ammo/FXE_ShotGun_Trail.uasset +++ b/Content/Legumix/Weapon/Ammo/FXE_ShotGun_Trail.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:51cae881f0f3868fe424e19680e917ff769b9f2f2ca1f2fc39ce49ae8df589b7 -size 342697 +oid sha256:f319a772b479fb77c96461a89e2cfb742316cfe9af7a5532d2366322a2fe8c03 +size 348406 diff --git a/Content/Legumix/Weapon/Revolver/BP_Revolver.uasset b/Content/Legumix/Weapon/Revolver/BP_Revolver.uasset index 0880497..22cc9d5 100644 --- a/Content/Legumix/Weapon/Revolver/BP_Revolver.uasset +++ b/Content/Legumix/Weapon/Revolver/BP_Revolver.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e5636f963c1928155266a34619aa083f98d026f483543cbd4887d8fcc5f25d2b -size 56497 +oid sha256:542c2d39cbd9cd6b8087b4f7b30adb3c381396c0ab7ffad58e464938ff52da97 +size 56876 diff --git a/Content/Legumix/Weapon/Shotgun/BP_Shotgun.uasset b/Content/Legumix/Weapon/Shotgun/BP_Shotgun.uasset index f0669ee..d86218c 100644 --- a/Content/Legumix/Weapon/Shotgun/BP_Shotgun.uasset +++ b/Content/Legumix/Weapon/Shotgun/BP_Shotgun.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0589a631e5202de33eb64f9a78b88c03f40a0fb798318f509117f980e3e29ad7 -size 56456 +oid sha256:08f9c257020e37e11f8018da3f36f1dea3b9f82d06c24f577f06085cecbb1be9 +size 56518 diff --git a/Source/LegumeMix/Private/Weapon/LMBulletTracer.cpp b/Source/LegumeMix/Private/Weapon/LMBulletTracer.cpp index 0d1c308..3aa4005 100644 --- a/Source/LegumeMix/Private/Weapon/LMBulletTracer.cpp +++ b/Source/LegumeMix/Private/Weapon/LMBulletTracer.cpp @@ -24,8 +24,11 @@ void ALMBulletTracer::Tick(float DeltaTime) Super::Tick(DeltaTime); } -void ALMBulletTracer::Initialize(const FVector& Vector) +void ALMBulletTracer::Initialize(const FVector& Vector, const FRotator& Direction, USceneComponent* Origin) { + SetActorLocationAndRotation(Origin->GetComponentLocation(), Direction); + TrailOrigin = Origin; + const double Distance = FVector::Distance(Vector, GetActorLocation()); float const LifeTime = Distance / Speed; diff --git a/Source/LegumeMix/Private/Weapon/LMWeaponManager.cpp b/Source/LegumeMix/Private/Weapon/LMWeaponManager.cpp index 1e027a8..025aec2 100644 --- a/Source/LegumeMix/Private/Weapon/LMWeaponManager.cpp +++ b/Source/LegumeMix/Private/Weapon/LMWeaponManager.cpp @@ -78,8 +78,7 @@ void ULMWeaponManager::CreateTracer(const EAmmoType Ammo, const FVector EndLocat if (ALMBulletTracer* Trace = GetWorld()->SpawnActor(Data.BulletTracer)) { - Trace->SetActorLocationAndRotation(GetCurrentWeapon()->GetTracerOrigin(), Direction); - Trace->Initialize(EndLocation); + Trace->Initialize(EndLocation, Direction, GetCurrentWeapon()->TracerOrigin); } } } diff --git a/Source/LegumeMix/Public/Weapon/LMBulletTracer.h b/Source/LegumeMix/Public/Weapon/LMBulletTracer.h index dcb977c..bccb6fd 100644 --- a/Source/LegumeMix/Public/Weapon/LMBulletTracer.h +++ b/Source/LegumeMix/Public/Weapon/LMBulletTracer.h @@ -18,7 +18,7 @@ public: void BeginPlay() override; virtual void Tick(float DeltaTime) override; - void Initialize(const FVector& Vector); + void Initialize(const FVector& Vector, const FRotator& Direction, USceneComponent* Origin); public: UFUNCTION(BlueprintCallable, Category=Legumix) void DestinationReached(); @@ -48,6 +48,9 @@ private: UPROPERTY(BlueprintReadWrite, Category=Legumix, meta=(AllowPrivateAccess=true)) bool bCanMove; + + UPROPERTY(BlueprintReadWrite, Category=Legumix, meta=(AllowPrivateAccess=true)) + TObjectPtr TrailOrigin; private: FTimerHandle TimerHandle; diff --git a/Source/LegumeMix/Public/Weapon/LMWeaponBase.h b/Source/LegumeMix/Public/Weapon/LMWeaponBase.h index 8f45fec..693d83c 100644 --- a/Source/LegumeMix/Public/Weapon/LMWeaponBase.h +++ b/Source/LegumeMix/Public/Weapon/LMWeaponBase.h @@ -46,9 +46,6 @@ public: UFUNCTION(BlueprintCallable, BlueprintImplementableEvent) void OnDefaultReload(); - - UFUNCTION(BlueprintCallable) - FVector GetTracerOrigin() const { return TracerOrigin->GetComponentLocation(); } protected: UFUNCTION(BlueprintCallable) @@ -61,6 +58,9 @@ public: /** The current state of the weapon. */ UPROPERTY(VisibleInstanceOnly, BlueprintReadWrite, Category="Legumix|Weapon") EWeaponState State; + + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta=(AllowPrivateAccess=true)) + TObjectPtr TracerOrigin; protected: /* Weapon Data */ FTimerHandle FireTimer; @@ -134,8 +134,5 @@ private: /* Components */ UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta=(AllowPrivateAccess=true)) TObjectPtr WeaponMesh; - - UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta=(AllowPrivateAccess=true)) - TObjectPtr TracerOrigin; };