Custom Collision makes character levitate

I’m setting up custom collision profiles to “fake” flying units in an RTS game. To do this I set up two Object types in my project settings (GroundUnit and AirUnit both set to Block). Then I set up collision presets for each. Both presets are identical to the Pawn preset except the object type is different (as well as air units ignoring ground units and ground units ignoring air units)

The problem is that when I enable this setting on my characters, they levitate about 1/2 their capsule height off the ground. Changing the Object Type back to Pawn fixes the problem but it makes the collision profiles useless as well. I’ve tried setting the object types response to overlap or ignore but then they just fall through the navmesh as well. What would be causing this problem?

Also, the characters have no collision on their mesh and this is all done on the capsule component. I am working on version 4.6.1

For some reason, Removing the AI controller stops this from happening. I’ll keep digging and testing to see what is causing the problem

So more digging into this has brought me closer. I’ve tracked it back to the Character movement component in some way. Inside of there, the AdjustFloorHeight function causes the character to move higher. I believe that this is because of it’s calculate the distance to the floor functions.

However, this seems to be called every tick (likely due to physics pushing the character down.

The first two itterations through it though actually make it into the check that allows it to move. The check in question is:

if (OldFloorDist < MIN_FLOOR_DIST || OldFloorDist > MAX_FLOOR_DIST)

Once, sure I can see that but why twice in quick succession. At first check I have a z value of 207.99 when selecting the character in the editor. The check however has a Z value of 259.525208. I don’t really know what this discrepancy is.

Anyway, it next calculates the distance to the floor which is -34.0 next the average distance for the floor (min and max height /2 ) to get 2.15000010 Finally it returns a move distance to offset the character. This is the average distance - the distance to the floor. In my case it results in a move distance of 36.1500015.

This would be great and fine but the second check is a little different. The new distance to the floor should now the old distance - the distance to move (or 34.0 - 36.1500015 = 2.1500015) BUT I instead have the distance to the floor set to something close to 14. So it does all the checks and adjustments all over again and translates even further up. If I comment out the entire AdjustFloorHeight function, it only moves up once (I’m guessing due to the UCharacterMovementComponent::FindFloor function when it just gets set up.

More digging is required though a nudge in a possible direction could be helpful.

I realize this question is a year old and you’ve probably moved on but I just ran into this problem myself and I may have a solution for anyone else that encounters this.

I have an Actor with a BoxComponent that spans the entire map with the OverlapAll collision profile. Because my custom profile was just a copy of Pawn it had WorldStatic (the object type of the OverlapAll profile) set to block and since the default response type of my custom Object Channel is block, the OverlapAll profile (along with several others that shouldn’t) was blocking my custom Object Channel. Editing the default profiles to have the expected response to my new channel fixed my problem.