Is it possible to change the shape of the DefaultPawn CharacterController?

The collision component for the DefaultPawn class is a sphere, but I wanted to know if it was be possible to change it to something else such as a box or a capsule, or even a mesh.

Thanks,
Ben

You can’t remove the native sphere component, but you could subclass it using a Blueprint and add a new collision component based on whatever shape you like. Just make the old CollisionComponent “NoCollision” to turn it off.

Could you explain how subclassing works and how it’s done?

I’ve tried replacing the collision component with a box collider and giving it identical settings to the original sphere collider, but it doesn’t seem to work.

Thanks for your time

1 Like

You can create a new blueprint and choose DefaultPawn as the base class (AKA subclass DefaultPawn).

Then in your component view you can disable the sphere component collision and add your box component.

You can turn on Collision preview in your viewport to double check that the box is activated (Alt+C)

By the way if you want good tutorials on Blueprints, just check out the Unreal Engine youtube videos.

Hmm… I think I’ve followed all of the steps, but the pawn is still not colliding. Is it something to do with the way the components are parented? I’m not able to change the parent of the MeshComponent, nor am I able to make the box collider the root.

1 Like

I see what you mean - I can’t get it to work with a Blueprint either. Sorry!

In that case, if you really want to use DefaultPawn the best option might be to make a copy of DefaultPawn.cpp / .h and change the constructor so that it uses the shape you want. (It’s hardcoded to use a USphereComponent ).

1 Like

Hmm. I gave it a try, but I’m almost certain I’m going about the process incorrectly since I’m getting compiler errors all over the place :stuck_out_tongue:

I’m not opposed to ditching DefaultPawn aside from the fact that I need the FloatingPawnMovement component, and I read that DefaultPawn was the only class to use for that.

1 Like

It looks like you are trying to make a vehicle, why not try using the WheeledVehicle class? It has a mesh root component.

I’ve investigated it as an alternative, but the WheeledVehicle class needs a Skeletal mesh as opposed to a Static mesh, and it also lacks the FloatingPawnMovement component which makes it unsuitable unfortunately.