Character Controller Falling Through World; is Using Physics?

Okay this is an odd one…

…I have two characters (not including the player of which behaves as expected) who are rather simple. They both have Animator, and a Character Controller. Only ONE of the characters has additional scripts…the Apex Pathfinding asset…otherwise there are no other scripts and neither have a RigidBody.

The first thing that surprised me is that the characters appear to be using Gravity, as they fall down to the ground. Fine no biggie, I just honestly didn’t recall that Character Controller used the built-in physics, and thought I needed either a RigidBody or manage my “physics” in script (which I’m doing for the Player character)…

…so here’s the real issue. After no particular amount of time (long or short), the character that is pathing around the game world will, for no definable reason on my end, fall through the game world as if the collider beneath it just disappeared. Here’s the kicker thought…the OTHER character, the one that has no other scripts other than the aforementioned Animator and Character Controller ALSO falls at that exact moment…never before, never after the first character falls…right at the exact moment. These two characters have absolutely nothing to do with each other and their prefabs are completely unique. When this phenomenon occurs they don’t even have to be anywhere near each other, yet it happens every single time.

  • I at first thought it was Apex Path, but again, only one character is using it…the other is just standing there with no other scripts other than the two…
  • Both of their Animator scripts are using Root Motion which I tried disabling. Additionally I tried changing their update modes from Normal to Animate Physics
  • The world geometry is using Mesh Colliders; I fear that one solution might be to use primitive colliders (box/sphere/capsule), but for terrain that could be a bit of work to make it feel natural.

Any idea whatsoever why the pathing character would just appear to stop using collision, and why that would simultaneously make another character that has nothing to do with the first ALSO fall?

Is there a way I can manage my own physics while using the Character Collider?

Is there any way I can intercept whatever is going on to check for collisions/ground before the character falls?

Is this just an odd bug? I’ve never seen this before and my player character is using a Character Controller, a ton of complex scripts including my own managed internal gravity and colliding with the very same colliders the NPC’s are, yet the Player Character never falls through the world.

Thanks for reading and any help anyone can offer

-Steven

EDIT…the vitals!:

Unity Pro/iOS Pro 4.6 beta 20 (but this occurred in 4.5.5f1)
Macbook Pro 15 (2014) 16 gigs, 750m, i7
OSX 10.9.5
Xcode 6.1 (6A1052d)

If the units with CharacterController are reacting to gravity and you don’t have any scripts on them to apply this, then the only possibility is that it’s being applied by the Animator. CharacterController does not use Rigidbody physics as mentioned on the CharacterController docs page. So I would try turning off the animator and moving the units around with scripting and see what happens.

As for falling through the floor, how far are you from world 0,0,0 and what’s your scene scale? Once you start getting very far from 0,0,0, floating point imprecision starts to affect things and you can start having all kind of issues like falling through floors, polygons flickering, etc.

Well I’ll be damn you’re right, it’s Apply Root Motion in the Animator!?

So then the question is why this is a thing? That is the common attribute between the two characters, yet the Player Character doesn’t suffer this fate and I’m most definitely using root motion with him…

…and let’s say for the sake of argument it was Apex Path causing this…why would the first NPC failing (and falling through the ground) cause the other NPC to fall who, again, is NOT driven by Apex? If it were a ‘system wide’ failure, then why would the PC be just fine and stay firmly grounded?

Additionally, I did apply NavMesh/Agent to the second NPC and when the Apex Path character fails, the NavMesh character does not, and in fact stays grounded indefinitely (yay). My issue really isn’t the “why” of Apex apparently failing, but rather why ANY failure on the part of one character would affect the other. Hmmm…

As for your last questions, I’m definitely not pushing the bounds of precision so we’re good there.

Thanks for responding btw. I was worried this would be swept aside as one of those ‘nebulous’ problems that can’t really be solved. :slight_smile:

-Steven

…aaaaand here it is, ha! Animator.gravityWeight

Well this is actually really good news then! I’m thinking this needs to be a bit more front and center in the documentation (if it is I apologize). Makes me rethink now how I’ve been doing my animation work in conjunction with gravity… :smile:

Cheers

-Steven

Glad you solved it, or at least found out what was causing it. Why Animator.gravityWeight would be causing collision failures at some point system wide is another question that would probably require more testing to determine if that’s what’s really happening. If it is, create a small scene with the reproducible problem and file a bug report.