Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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

Product Version: Not Selected
more ▼

asked Jan 14 '15 at 07:24 PM in Blueprint Scripting

avatar image

2.2k 104 75 164

avatar image Justin.Dooley Jan 20 '15 at 11:43 PM

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

avatar image Justin.Dooley Jan 21 '15 at 11:31 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Jan 26 '16 at 07:06 PM

avatar image

934 44 62 211

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question