Horizontal player (quadruped) setup

Hello,

Just getting started with UE4. I’m building a game where the player is a quadruped, and thus is in a horizontal position. However, I’m having difficulty finding the best way to set this up. This is my first time creating a quadruped, so maybe I’m not aware of some tricks. :slight_smile:

My initial thought was to rotate the character capsule 90 degrees so it’s horizontal, but it seems like this isn’t allowed. It’s not exposed in the editor, and when I invested the code, I found this comment in Character.

/** The CapsuleComponent being used for movement collision (if has CharacterMovement). Always treated as being vertically aligned in simple collision check functions. */

Is my only option to create a custom pawn and create a character class myself to allow this? Could I derive from character and override portions of it to allow for horizontal player (saving me time from recreating a lot of things from ACharacter class)? Is there another trick I’m missing?

Thanks in advance.

We haven’t had any trouble with quadrepeds.

Can you share a screenshot?

Here’s some video’s from ingame so you can see, there’s no problem with the cat. https://www.youtube.com/channel/UCzYfe9p7O5hfZCjQiiI5ZPQ

Edit: We aren’t doing any special with the collision capsule. In the blueprint made it shorter and wider, that is all.

I ended up playing with the capsule size and I think I managed to get it to fit well. I had some concerns because the capsule seemed fairly wide in the blueprint editor, but once I loaded up a test level and walked around and seeing how narrow of openings I could walk through, I think it looked okay. Walking through the narrowest opening still felt narrow which is what I was hoping for.

Thanks for the tip Mike!

This something I find very curious. Lets say you have a very elongated quadruped… like a dragon. Basically if you use the capsule in its current vertical state your character will not be able to pass through gaps that are as wide as your character is long. Which could result a capsule being 75meters wide but your character is only 10 meters wide.

Implying it would get stuck when 60 meters away from something.
But I have seen games with dragons. So there has to be a trick to this.

This character setup is really only designed for a things that are generally the dimensions of a person. If you want something for other less common characters, then generally you’ll need to come up with a custom solution.

Hmm… might have to pay a C++ developer to design a new capsule then or code something that enabled physics assets of characters to be blocked by brushes, other meshes.

Hey,
we are working on a game with a quadruped character as well. Did you find a solution for your problem so far?

This would be a good starting point.

It’s also worth mentioning that while ACharacter has a CapsuleComponent built-in, it doesn’t have to be your root component, or even used at all. You can prevent it from being created by using FPostConstructInitializeProperties’s DoNotCreateDefaultSubobject, as follows:


AQuadrupedCharacter::AQuadrupedCharacter( const class FPostConstructInitializeProperties& PCIP )
	: Super( PCIP.DoNotCreateDefaultSubobject(ACharacter::CapsuleComponentName) )
{
}

Of course, you’ll have to put a replacement primitive component of your own as RootComponent in your derived class constructor.

Also, make sure the MovementComponent’s UpdatedComponent points to this new primitive component.

Lastly, and this is the most crippling problem, CharacterMovementComponent makes a lot of assumptions about actually having a single CapsuleComponent, so you likely will have to roll out your own version of CharacterMovementComponent.

Why don’t you use a small capsule (smaller than mesh) and then just enable collision on the skeletal mesh?? This works fine for me or perhaps I am missing something???

Hey Guys,

thx for the answers so far, that already helped me a lot. I am writing my own MovementComponent now.
We came to the same solution that we will use two horizontal capsules. My question now is how to add the physics to the character? Do I have to write my own code,
or is there some unreal physics stuff which can take care of all the collisions and so on?

Cheers Pascal

Hi, you can set all the physics + collision properties from within the editor’s ‘details’ panel.

I’m still unsure why you need two capsules though, I’m concerned that I am maybe missing something here??? I only use the capsule for movement on my quadruped and handle the collision with the mesh.

Hey,

thx for the answer. I think you are absolutly right, that would work for our purposes. I activated the mesh collision, but unfortunatly with no effect. Do I have to do something special to have the normal sphere collider and the mesh working?

Your welcome, I cannot remember how I achieved this from the top of my head (I’m at work at the moment so cant check right now), I thought it was simply a case of setting the collision of the skeletal mesh to ‘Block All’…I have it working at home so I’ll check what settings I have enabled once I get back.

Reading HERE It mentions:

However, I don’t recall making a custom physics asset for my elephant.

Thanks a lot for your patience. Would be awesome if you could look at your example. Is your elephant a controllable character?

Yes, well…it is controlled by an AI controller but I could equally make it a human controllable character.

Hi,

we are still struggeling with the collider setup. If you wont mind, could we have a look at your elephant asset?

Okay, so it seems that when I imported my mesh, I checked a box that automatically created a physics asset, however this can easily be done by finding your skeletal mesh within the content browser, right clicking it, find the create option, then from there select ‘physics asset’. Then in my character blueprint I selected the skeletal mesh, navigated to the collision settings and set it to ‘Block All’.

I don’t think I’ll be able to send you any of the files I have, however I will post screens this evening (after work) if you are still having problems.

Unfortunatly we are still having the problems. What kind of object is your elephant? Our wolf is a character. I have tried your suggestion amultiple times now, even in a new project. Would be awesome if you could send me the screenshots. That would help a lot. Thank you :wink:

The elephant is a character. I forgot to mention one point though…Once you have created a physics asset for your character, you will also need to assign it to the mesh via the details panel…

So the steps are:

1: Create a physics asset for your skeletal mesh
2: Assign the physics asset to the skeletal mesh via the details panel
3: Set the collision of the skeletal mesh to ‘Block All’ via the details panel

I hope this helps…screens shortly…