I have a paper character that I created in C++. I added a box collision to the actor in the constructor. Then I created a blueprint based on this C++ class. In the blueprint viewport I can see the collision box and it is listed as inherited. When I spawn the blueprint into my level and show collisions, the box that I added is not shown. I CAN see the capsule collision that was inherited from character in my level, so why does my box collision not spawn in the level.
relevant paper character code:
Aoverworld_player_char_c::Aoverworld_player_char_c()
{
// configure collisions
top_collision = CreateDefaultSubobject<UBoxComponent>(top_collision_name);
top_collision->SetRelativeLocation(top_collision_loc);
top_collision->SetRelativeRotation(top_collision_rot);
top_collision->SetRelativeScale3D(collision_scale);
// configure begin overlap callbacks
top_collision->OnComponentBeginOverlap.AddDynamic(this, &Aoverworld_player_char_c::boxBeginOverlap);
// configure end overlap callbacks
top_collision->OnComponentEndOverlap.AddDynamic(this, &Aoverworld_player_char_c::boxEndOverlap);
}
void Aoverworld_player_char_c::boxEndOverlap(UPrimitiveComponent* overlapped, AActor* actor, UPrimitiveComponent* other_comp,
int32 other_body_index)
{
UBoxComponent* collision = Cast<UBoxComponent>(overlapped);
if (collision != nullptr)
{
Edirection dir = Edirection::UNKNOWN;
FString name = collision->GetName();
if (name == top_collision_name.ToString())
dir = Edirection::UP;
if (dir != Edirection::UNKNOWN)
processCollisionEnd(dir, actor);
}
}
void Aoverworld_player_char_c::boxBeginOverlap(UPrimitiveComponent* overlapped, AActor* actor, UPrimitiveComponent* other_comp,
int32 other_body_index, bool from_sweep, const FHitResult& sweep_result)
{
UBoxComponent* collision = Cast<UBoxComponent>(overlapped);
if (collision != nullptr)
{
Edirection dir = Edirection::UNKNOWN;
FString name = collision->GetName();
if (name == top_collision_name.ToString())
dir = Edirection::UP;
if (dir != Edirection::UNKNOWN)
processCollisionStart(dir, actor);
}
}
here is the viewport, you can see the (small) capsule in the center of the sprite and can see the 4 collision boxes
here is the level during play with collision showing. You can only see the capsule