hey guys, how can I overlap only a specific pawn to my box collision? I Do I have to cast? I can do this in bp but i’m trying to do in c++
hankssssss
You can setup your collision in a way that only x type of objects can trigger the overlap event, but either way, you’ll have to use casting anyways. Bind a function to the box collision component’s begin overlap event, and cast OtherActor into the desired class.
Collision Overview
Event Binding in UE4 c++
AMyCustomActor* MyCustomActor = Cast<AMyCustomActor>(OtherActor);
if (MyCustomActor)
{
// ...
}
thanks dude! I decided to move my blueprints to c++. Do I have to declare first the function? or just put that lines in the .cpp?
Declare functions in .h and implement them in .cpp