how to detect edge so my character does fall sooner and not stand in “air”? Re-sizing capsule is not an option since I have different characters with different sizes. Character should detect ledge while they are over it with their legs and fall down immediately.
I don’t think so. This is a standard 3rd person character template where the capsule is holding the character on the edge. If I move the character a bit forward it falls down.
If looks like the bottom of your character collider is still over the floor collider, hence it’s not triggering the fall.
Decrease the radius of your CapsuleComponent (under section Shape > Capsule Radius). The downside of this is it will allow your character to get closer to walls and other obstacles.
Edit: Sorry, I just re-read you post. You could try and dynamically assign the Capsule Radius based on the scale of the character. Alternatively, you can try and use line tracing from your legs down and temporarily disable capsule collision when nothing is detected, but this might be expensive on the performance if done per frame.
Hello, thank you for your help. I already did that but in my case I am doing one funny character that has a larger head and thinner legs so it looks really “wrong” to have its nose in the wall
Do you think it would be a good idea to at least add additional Capsule in front of the character and measure the distance to other actors, just to prevent it to get too close and sink the nose into the wall? Or is there a better solution?
You could add an extra collider to your Character (like a sphere for the head). Just need to make sure it won’t catch the floor when falling - for example detect free fall and disable it’s collision, otherwise it could look really funny
Thank you , it works perfectly. I did my own solution more than a year ago but I overcomplicated the whole deal. It worked well but this one is way simpler
Thank you! I have been trying to find a good solution to this and I am surprised that the threshold variable is not featured more in the documentation or in people’s videos. I’ve seen people do very advanced capsule resizing and other hacks, and there was a variable for it all along…
If your pawns are perching at ledges just a little higher than max step height, you could probably kinda fix it with ik as long as one foot is on the ledge.. If using an anim bp derived from the template Manny, open the ik post process control rig called near the end of anim graph and bump up the distance for the foot ik traces a bit. Could end up with some funky poses tho (like one of pawn’s knees up by their nose), but at least it would look less floaty.
This is a problem for me for a 2D side scroller using UE. It is that capsule bottom. I tried the tweaks and tricks and it ultimately did not help. At least not imo to have a true 80s side scroller feel. So then I tried coming up with it all myself for just a pawn or an actor bp, and I learned the hell of NOT using the character bp. What I came up with was this. Use line traces below the foot of the character going straight down just a bit to detect “land” (just an actor with an actor tag land). Land not under you? Constant -Z to simulate gravity. I then also had line traces horizontally going out left and right to the player to detect the “surfaces” of a platform. Say a pipe with a flat top. That worked DECENT but it was still kind of wonky.
A character with a SQUARE capsule component would solve all of this. Supposedly there is a way with C++ to swap out the capsule with a traditional rectangle collision. Has anyone heard this?
Then I think I saw how the capsule component actually benefits. Uneven terrain. This would be the difference of a side scroller like say Shinobi and one like Strider. Yet still I would actually try to make a Shinobi or Rolling Thunder if it wasn’t such a thing for the capsule.
But even if you use the capsule for the player. The enemies can’t use capsules lest you use the AI controller. And that just seems like overkill for a simple 2D side scroller game (probably sprites).
In theory you could make a new c++ class with pawn as a parent, and basically copypaste the character class code into; it replacing the capsule with a box. Would obviously need to cleanup anything expecting a capsule (or capsule-like behavior) in there, but it’s probably doable.
That’s a bit above my pay grade. I struggled just making my own cpp character class so I could add GAS attributes to my pawns
In addition to changing perch radius in character movement component, there’s also a checkbox you can tick called Use Flat Bottom for Floor Check or some such which uses a flat disc instead of the capsule to determine if char is on the floor. Tried ticking that in my 2.5d side project, and char doesn’t dip down when teetering on a ledge like they did with raw capsule.
The capsule shape (egg) is not conducive to side scroller games as they have been known throughout history. Unreal is obviously overqualified to make older video games such as side scrollers. The capsule situation is not just problematic from the falling off of land point of view, but you can also have skewed jumps because of the top of its rounded shape. It is a shame, it seems like something that would be a relatively easy yet worthwhile fix.
Tweak the perch radius in the CMC to control how far off a ledge you can stand.
As for capsuole throwing jumps off course when your “head” clips something, try attaching a box collision to egg so top of char is flat. This should also let chars stand on each other’s head like super mario 2.