How do I create a capsule for a animal (ex. wolf) character?

I just realised there is a mistake. the child actor should be of course a child of the camera boom. but see my edit in my answer too.

Yes the problem is that the child actor is not actually doing the colliding but the probe of the spring arm. I was thinking about trying to attach some spheres with physical simulation to the character but that seems excessive and unnecessary.
At this point Im more interested why the spring arm is working and how. That’s the real mystery here.

Indeed the probe size must be set accordingly to the collider size and its position, and spring arm length.

I guess spring arm works because it is not meant to be used exclusively with cameras, it is more like a selfie perch or a pole

This solution is good !
However it needs some improvements. If you place your quadruped against a wall and parallel, and then if you turn in place, the child actor will clip. I’ve added a capsule on left and right side (front and back) and on overlap it blocks the input (so now when turning in place, my quadruped won’t clip, it just stop turning). Something more sophisticated would be to estrange the character from wall during turn.

There is also another issue, if you meet the wall with very low angle, it blocks and character stops, which is logical but not fun to play. I may have an idea for that, when the “collider” hits the capsule, it does some trace to find the angle, and deflect character if angle is under a certain threshold (can be good to have the character stop anyway if he is almost perpendicular).

Some times ago I’ve tried someting similar with a physic constraint, but it was not good, so really thanks a lot for your spring arm idea. For front I have 2 spring arms with 2 actors, so it allows to have collision for the head, but for feet aswell, which is very nice for a low obstacle

Isn’t it simpler to just add invisible walls around your obstacles (aka “Blocking Volume”) ?

All objects are not necessarily cubic or geometric and it would implies to rework collision for every asset used in the scene.

Hi guys,
Thanks for this answer and this discussion. I am playing with the numbers for like 7 hours straight now but for the life of me cannot get to the beautiful Motion in the original gif where the bear almost touches the wall… At most I am able to get him a few units before wall… and for some reason it also moves slowly in some of the scenarios… Only on one of the scenarios the wolf was blocked correctly but it was far from the wall… Sharing some screenshots… Here are my numbers :

So what are your numbers ? I will highly appreciate some screenshots or an explanation how that mechanism is working …
Thank you very much :slight_smile:

Here is what I have. In my case the collider is a child bp with a sphere collision (it works as well as a sphere mesh) and I have 4 of these, each one with its own spring arm. On the screen you see the one for up front.
In fact the collider is not the one which collides with the world, The probe (invisible sphere) collides with the world and pushes (or rather shrink) the spring arm. Then the collider (blue on my screenshot), attached to the arm, will collide with capsule (that is what stops the movement). You can see that the collider itself is not at the end of the spring arm.

For numbers it is hard to tell. What you can do, since it is possible to parent several objects on a spring arm, is to have a simple sphere (no collision) that has same diameter as the probe attached to the arm ( at 0, 0 ,0 location so it will symbolyze the probe, however I’m not sure if the probe size is related to radius or diameter), shrink a bit your actual sphere and place it beetween your capsule and the probe (still attached to the arm). Turn the character capsule visible and check ingame.
You will see the probe colliding with wall, pushing the collider to the capsule and you will have a better idea of sizes you need

Thanks ! It finally works for me. It turned out that I had collisions for the Collider (= ChildActor) all wrong - It made collisions with the wolf itself which triggered very weird behavior.
Thanks for the drawing and have a great week !

I know this question is old enough… But I think it’s still important to lot of people to get a solution. I found this way pretty simple to make better collision for complex skeletal meshes: Unreal Engine 4 Punch Animation & Collision - YouTube

Hope it helps anyone like it did it to me :smiley:

Thanks Billy! However, that technique will only work for setting up secondary collisions with physics objects. It will not constrain the movement of the character. That is unfortunately determined by the capsule. Heerbann and Grot13 below show a workaround that should help, but I have not personally been able to test the solution yet.

OK!!! AFTER SEARCHING FOR THE ANSWER FOR THIS FOR TWO DAYS WITH NO EZ SOLUTION.
I HAVE FINALLY FOUND THE SOLUTION TO THIS AND DECIDED TO SHARE IT WITH YOU ALL.
AND ITS EZ AF!!!

  1. Enable physics for the capsule as default
  2. Add sphere collisions for the head, make sure it’s overlapping with the capsule.
  3. Use code to disable capsule physics.
    YOU ARE WELCOME
6 Likes

Thanks gupq. Could you elaborate a bit on your process? Perhaps post an example?

I thought that was clear enough but here is a video I made just for you: Unreal Engine 4 how to create horizontal characters that doesn't fit the default vertical capsule - YouTube

7 Likes

Wow, that is brilliant! I cannot thank you enough for posting this helpful video! I’m sure this will help many people to finally solve this issue with Quadruped Characters in UE4 – seeing it demonstrated makes all the difference. :slight_smile:

Thanks a lot for posting your solution !!
I’ll try this for my quadrupede characters, but I have fishes that move with a simulated capsule, will it work for them?

Hi everyone, great find by gupq. Just wanted to add, if you’re curious why you need to enable physics simulation and then flip it back off - it seems related to this comment in source:

/** Finds all children that are technically welded to us (for example kinematics are welded but not as far as physx is concerned) and apply the actual physics engine weld on them*/
void ApplyWeldOnChildren();

Seems like if you have kinematic shapes (non-physics-simmed) even if they are set to be welded they aren’t technically welded in the PhysX engine. So when you do a sweep test with the capsule it doesn’t use the full array of shapes.

When you turn physics sim on it welds the children in physx, and then if you turn simulation back off it retains that weld…I think!

2 Likes

Thanks jmargaris! That’s an interesting find and good to know!

I am trying to do similar things in UE5 so I would like to ask if this method still apply to UE5?

As I know UE5 has changed to physics engine to its Chaos one.

Thanks

Can confirm, the solution with welding the collision shapes by setting the capsule to simulate physics and then turning it off also works in UE5.

2 Likes