Hi,
I am trying to have my StaticMeshComponent generate overlap events on overlap with the Pawn ECollisionChannel. I set up my staticmeshcomponent to achieve this in the constructor for my class. This actor is attached to the player, who is ignored within the collisions of the actor, I have also noticed that it does not seem to block EWorldStatic objects either so is there some simple setting I am missing?
Thanks for any and all help
Also, if I declared a simple collision capsule around my object in my static mesh object (from the editor), will the static mesh component use that simple collision object for its’ interactions, or will it use the complex one?
My Actor Constructor
ACharWeapon::ACharWeapon(const class FObjectInitializer& FOI)
{
//Explicitly No Ticking of Weapon Classes
PrimaryActorTick.bCanEverTick = false;
// Create Static Mesh Component
StaticMeshComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
StaticMeshComponent->BodyInstance.SetObjectType(ECC_WorldDynamic);
StaticMeshComponent->OnComponentBeginOverlap.AddDynamic(this, &ACharWeapon::OnOverlapBegin);
StaticMeshComponent->bGenerateOverlapEvents = true;
}
My Collision function declared in the ACharWeapon header file
void OnOverlapBegin(UPrimitiveComponent* OverlappedComp, AActor* OtherActor,
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
My Definition of the function
void ACharWeapon::OnOverlapBegin(UPrimitiveComponent* OverlappedComp, AActor* OtherActor,
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT(
"CharWeapon: Successuflly overlapped other actor")));
}
My Setting up of the Collision responses, ECC_Player is a collision channel I setup to represent the player to seperate it from Pawns.
void ACharWeapon::PlayerSetupCollision()
{
StaticMeshComponent->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap);
StaticMeshComponent->SetCollisionResponseToChannel(ECC_Player, ECR_Ignore);
StaticMeshComponent->SetCollisionResponseToChannel(ECC_Camera, ECR_Ignore);
}