Custom collision on Character

I am making a game where the playable character is a cat. I used the ACharacter for some time, and it’s very handy. The only problem I am facing, and it’s quite annoying, is that I cannot have any other source of collision on my character than the CapsuleComponent.

Resizing the capsule isn’t an ideal solution either, because it doesn’t fit a cat like it would on a humanoid. Also it causes ugly unwanted collisions.

What I could find is that it would take a rewrite of the ACharacter / UXMovementComponent classes to suit my needs.
I took a look at these classes, and I had trouble finding what to modify, or were to look at.

Time is a strong constraint for me, and I cannot estimate the time it would take me to do this. I am also seeking advice on the feasability of this, and the complextiy of the task : I need to know if it’s worth the risk.

tl;dr

How can I add other collisions to an ACharacter ? I don’t particularly want to replace the capsule, but to have an extra box collision for example.

Bump, any help ?

You can’t change the shape collision because ACharacter is a base c++ class. So what you need is to create your own character class based on a Pawn class. Basically if you take a look in

Engine/Source/Runtime/Engine/Private/Character.cpp

You wiil see this in constructor:

CapsuleComponent = CreateDefaultSubobject<UCapsuleComponent>(ACharacter::CapsuleComponentName);
CapsuleComponent->InitCapsuleSize(34.0f, 88.0f);

static FName CollisionProfileName(TEXT("Pawn"));
CapsuleComponent->SetCollisionProfileName(CollisionProfileName);

CapsuleComponent->CanCharacterStepUpOn = ECB_No;
CapsuleComponent->bShouldUpdatePhysicsVolume = true;
CapsuleComponent->bCheckAsyncSceneOnMove = false;
CapsuleComponent->bCanEverAffectNavigation = false;
RootComponent = CapsuleComponent;

In c++ you can achieve what you want by extending the pawn class and changing this part.
In blueprints create a blueprint based on a pawn and edit components in the viewport

Thanks but I already know this. I don’t want to replace the capsule, I want to add extra collision volume to my character.

Adding a custom shape collision?

https://docs.unrealengine.com/latest/images/Engine/Blueprints/UserGuide/Components/AddBoxComponent.jpg

[Docs][2]

Indeed, but that doesn’t work …

Same issue here, this appears to be a widespread problem and it seems there’s several related threads on answer hub. Everything points to the workaround of inheriting from Pawn instead of Character, as the latter seemingly forces us to use the capsule cylinder alone.

If you look at this thread, the Epic dev explains that this is by design and it doesn’t sound like this will be changed any time soon :frowning:

Maybe this is what u was looking for?

up, any news about that?

I stopped using UE4 at the end of this project 4 months ago, and we did not solve our problem satisfyingly. So, no news sorry.

In addition to the link provided above, this question has been revisited here:

https://answers.unrealengine.com/questions/344902/did-epic-forget-a-basic-character-function-for-blu.html

Zak Middleton has explained that while there will likely not be an “out of box” solution for a custom shaped root capsule component, you can likely create a solution yourself starting here:

UCharacterMovementComponent::PhysicsRotation() with custom checks to see how far towards the rotation the capsule may turn

The following article explains in much greater depth why the idea of a custom shaped root capsule component, like other apparently good ideas, is not already integrated into the engine:

https://headcrash.industries/stories/why-your-idea-might-not-make-it-into-ue4/

In the meantime, anyone who feels they have a viable solution is welcome to submit their solution via GitHub or sell it as a plug-in through the Marketplace.

Thank you for the feedback regarding this issue. It has not been completely disregarded and may eventually be incorporated into the engine.