Hello,
So I am very new to both C++ and Unreal Engine, although I have experience in other languages, the UE library is completely foreign to me, so maybe someone can help me out here.
I have create a class called “UsableObject.h” which is a extension of AActor class, what I want to do is check if they player is looking at a AActor, using a SingleLineTrace. This works, I have traced objects, such as the demo chair and table objects. The next thing I want to do is see if my new Traced Actor is a UsableObject, if it is, then do etc.
What I have tried to do:
if (GetWorld()->LineTraceSingle(HitData, Start, End, ECC_Pawn, TraceParams)){
if (HitData.GetActor())
{
if (HitData.GetActor()->IsA(AUsableItem::StaticClass()){
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("Trace"));
}
}
}
This doesn’t work, Any suggestions?
Also, my object does not have any collision, so I do not know how to add that/if I need to.
Thanks,
Joel Comberiati