Hi all
I have created an Weapon class which extend from Item class wich extend from AActor (in C++)
but when I’m placing a BP weapon (entend from Weapon class(c++)) I can’t move it on the world
What I have done wrong ?
This is my Item Class :
#pragma once
#include "GameFramework/Actor.h"
#include "Item.generated.h"
UENUM(BlueprintType)
namespace EItemType
{
enum Type
{
IT_ARMOR UMETA(DisplayName = "Armor"),
IT_ARMOR_MOD UMETA(DisplayName = "Armor Mod"),
IT_WEAPON UMETA(DisplayName = "Weapon"),
IT_WEAPON_MOD UMETA(DisplayName = "Weapon Mod")
};
}
UCLASS(BlueprintType, Blueprintable)
class AItem : public AActor
{
GENERATED_UCLASS_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
TEnumAsByte<EItemType::Type> ItemType;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
FString _name;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
FString _description;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Mesh")
TSubobjectPtr<USkeletalMeshComponent> ItemMesh;
};
the C++
#include "Resistance.h"
#include "Classes/Items/Item.h"
AItem::AItem(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
ItemMesh = PCIP.CreateDefaultSubobject<USkeletalMeshComponent>(this, TEXT("ItemMesh"));
ItemMesh->MeshComponentUpdateFlag = EMeshComponentUpdateFlag::OnlyTickPoseWhenRendered;
ItemMesh->bChartDistanceFactor = true;
ItemMesh->bReceivesDecals = false;
ItemMesh->CastShadow = true;
ItemMesh->SetCollisionObjectType(ECC_WorldDynamic);
ItemMesh->SetCollisionEnabled(ECollisionEnabled::NoCollision);
ItemMesh->SetCollisionResponseToAllChannels(ECR_Ignore);
ItemMesh->SetCollisionResponseToChannel(COLLISION_WEAPON, ECR_Block);
ItemMesh->SetCollisionResponseToChannel(ECC_Visibility, ECR_Block);
ItemMesh->SetCollisionResponseToChannel(COLLISION_PROJECTILE, ECR_Block);
}