Compare commits

..

2 Commits

Author SHA1 Message Date
baz 01efe40a15 Add FPWeapon 2024-05-10 18:03:33 +01:00
baz e97ed90ffd Replace SkeletalMesh with SkeletalMeshComponent 2024-05-10 18:03:22 +01:00
25 changed files with 77 additions and 8 deletions

Binary file not shown.

BIN
Content/Weapons/FPWeapon/Materials/BaseMaterial.uasset (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

BIN
Content/Weapons/FPWeapon/Materials/M_FPGun.uasset (Stored with Git LFS) Normal file

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.

BIN
Content/Weapons/FPWeapon/Mesh/SK_FPGun.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Weapons/FPWeapon/Mesh/SK_FPGun_Physics.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Weapons/FPWeapon/Mesh/SK_FPGun_PhysicsAsset.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Weapons/FPWeapon/Mesh/SK_FPGun_Skeleton.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Weapons/FPWeapon/Textures/T_FPGun_M.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Weapons/FPWeapon/Textures/T_FPGun_N.uasset (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

View File

@ -188,6 +188,7 @@ AWeapon* ANakatomiCharacter::InitializeWeapon(TSubclassOf<class AWeapon> weapon)
FActorSpawnParameters SpawnParameters; FActorSpawnParameters SpawnParameters;
SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
AWeapon* Weapon = GetWorld()->SpawnActor<AWeapon>(weapon, SpawnParameters); AWeapon* Weapon = GetWorld()->SpawnActor<AWeapon>(weapon, SpawnParameters);
Weapon->SetOwner(this);
Weapon->AttachToComponent(GetMesh(), FAttachmentTransformRules::SnapToTargetNotIncludingScale, "WeaponHand"); Weapon->AttachToComponent(GetMesh(), FAttachmentTransformRules::SnapToTargetNotIncludingScale, "WeaponHand");
Weapon->SetActorEnableCollision(false); Weapon->SetActorEnableCollision(false);
Weapon->SetActorHiddenInGame(true); Weapon->SetActorHiddenInGame(true);

View File

@ -11,7 +11,7 @@ ARandomWeapon::ARandomWeapon()
void ARandomWeapon::BeginPlay() void ARandomWeapon::BeginPlay()
{ {
WeaponProperties = RandomWeaponParameters->GenerateRandomWeaponProperties(); WeaponProperties = RandomWeaponParameters->GenerateRandomWeaponProperties();
WeaponSkeletalMesh = RandomWeaponParameters->PickRandomMesh(); WeaponSkeletalMeshComponent->SetSkeletalMeshAsset(RandomWeaponParameters->PickRandomMesh());
FireSound = RandomWeaponParameters->PickRandomSoundBase(); FireSound = RandomWeaponParameters->PickRandomSoundBase();
FieldSystemActor = RandomWeaponParameters->PickRandomFieldSystem(); FieldSystemActor = RandomWeaponParameters->PickRandomFieldSystem();

View File

@ -6,7 +6,14 @@
// Sets default values // Sets default values
AWeapon::AWeapon() AWeapon::AWeapon()
{ {
WeaponSkeletalMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Skeletal Mesh Component"));
WeaponSkeletalMeshComponent->SetCollisionProfileName(FName("NoCollision"));
WeaponSkeletalMeshComponent->SetCollisionEnabled(ECollisionEnabled::NoCollision);
WeaponSkeletalMeshComponent->SetSimulatePhysics(false);
WeaponSkeletalMeshComponent->SetGenerateOverlapEvents(false);
WeaponSkeletalMeshComponent->SetNotifyRigidBodyCollision(false);
SetRootComponent(WeaponSkeletalMeshComponent);
} }
// Called when the game starts or when spawned // Called when the game starts or when spawned
@ -19,12 +26,12 @@ void AWeapon::BeginPlay()
USkeletalMesh* AWeapon::GetSkeletalMesh() USkeletalMesh* AWeapon::GetSkeletalMesh()
{ {
return WeaponSkeletalMesh; return WeaponSkeletalMeshComponent->GetSkeletalMeshAsset();
} }
void AWeapon::SetSkeletalMesh(USkeletalMesh* USkeletalMesh) void AWeapon::SetSkeletalMesh(USkeletalMesh* USkeletalMesh)
{ {
WeaponSkeletalMesh = USkeletalMesh; WeaponSkeletalMeshComponent->SetSkeletalMeshAsset(USkeletalMesh);
} }
TEnumAsByte<WeaponState>* AWeapon::GetCurrentWeaponStatus() TEnumAsByte<WeaponState>* AWeapon::GetCurrentWeaponStatus()

View File

@ -29,8 +29,8 @@ class NAKATOMI_API AWeapon : public AActor
GENERATED_BODY() GENERATED_BODY()
protected: protected:
UPROPERTY(EditDefaultsOnly) UPROPERTY(BlueprintReadWrite)
USkeletalMesh* WeaponSkeletalMesh = nullptr; USkeletalMeshComponent* WeaponSkeletalMeshComponent;
UPROPERTY(EditDefaultsOnly) UPROPERTY(EditDefaultsOnly)
TEnumAsByte<WeaponState> CurrentWeaponStatus; TEnumAsByte<WeaponState> CurrentWeaponStatus;
@ -65,6 +65,7 @@ public:
protected: protected:
// Called when the game starts or when spawned // Called when the game starts or when spawned
UFUNCTION(Blueprintable, BlueprintCallable)
virtual void BeginPlay() override; virtual void BeginPlay() override;
public: public: