Hello,
So I am very new to UE, so I am not really sure how a lot of this stuff works, or why it is not.
I have set up a “UsableObject” class to extend an AActor class. I have set it up, so that I can add a mesh to it and place it somewhere on my map, and then my player should be able to do a line trace, and it is looking at the object, you can use it. So I have a implemented line trace, using ECC_Pawn Channel.
Now from my understanding (I may be wrong) I do not have a few options:
A)
Create a custom trace channel that only my UsableObjects are a part of, and if my Object is in sight, then do X
B)
Use a generic trace Channel then check if the traced object is of type UsableObject
I have already set up a version of B), but I feel like A) might be more efficient, although I have no clue how to implement it, which if there are any help with that, it would be great. But even the B) method, does not work, I am thinking it is because my UsableObject, does not have any collision. I am not sure why that is, here is my actor class with my attempt at an implementation of method A.
#define USABLE ECollisionChannel::ECC_GameTraceChannel1
// Sets default values
AUsableItem::AUsableItem(const class FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
itemName = "Name";
itemType = "Type";
collidable = false;
holdable = false;
MeshComp = ObjectInitializer.CreateDefaultSubobject<USkeletalMeshComponent>(this, TEXT("Mesh"));
SetActorEnableCollision(true);
MeshComp->SetCollisionResponseToChannel(USABLE, ECR_Block);
}
Any help? I have been working on this a while, and do not know how to continue.