Forum rules - please read before posting.

Avoiding getting stuck while using "Move to point" action

Hi @ChrisIceBox ,
It's been some time since the new rigidbody NPC/Player movement system was changed. I created this issue earlier trying to get an easy solution to our problems with it:

Related to these AC changes.
  • Added: Option for 3D characters to not rely on their Rigidbody for movement
  • Changed: Rigidbody-based characters are now moved by applying forces - Interpolation should be set for smooth motion, and Masses may need increasing to prevent object-pushing

In the end the "global switch" probably wasn't really what we needed. We ended up using a mix of "Move with rigidbody"=On for the player character and "Off" for most NPC's. This allowed the NPCs to avoid getting stuff all over the scenes, and the player movement became somewhat smoother. 

However, ever since we've had the main player get stuck in all kinds of places when using the "Move to point" action, in very annoying ways. Basically its added the possibility for the game to become unplayable in about 400 - 500 different places. And not just theoretically, but it happens all the time.

That is, for each action where "Move to point" is used with "Wait until finish?", and there is an NPC or static geometry in between the points. Our Navmeshes are quite simple, though could be improved.

We've tried changing the colliders to round (boxes to sphere or capsule colliders), material and rigidbody properties hoping that less friction would allow the char to slide just past the object (works in rare cases). 

The problem continues, and also happens regardless of "pathfinding" on/off.  The simplest way to avoid the problem seems to be to disable "Wait until finish", and then add another action with "Engine : Wait" for a few seconds, so the the start of the movement is shown, but then it continues to next action. 

But this makes the cutscenes pretty crappy/nonimmersive, and we dont want to crappify 400+ cutscenes, if possible.

The only thing the user can do when stuck is to press "Esc" and load an older save (this works on desktops only, because we set "Esc"-key to open pause menu. Not sure if its a bug that it will also open the menu including saving options even when a cutscene is running).

When looking at these forums for a solution, I noticed for example this case, which has some similarity to our case:

Now, to me it seems that the simplest solution to the problem would be if "Move to point" offered a few additional options, for example a "maximum time for movement", so if the movement destination is not reached within say 10 seconds, it will just continue with the next action in the cutscene. Oh, and an additional checkbox to teleport to target if the destination wasnt reached in time. Could this be an future option in AC?

For now I'm trying to come up with a way to programmatically get the char unstuck, and continue to next part of the actionList. I'm now sure how to detect the problem reliably, nor how to safely do the "unstucking" (though the link above gave some ideas). 

I could do the check also for example only when user happens to press "Esc" while a "Move to point" action in cutscene is in proggress). Any simple and robust way to do this?

Comments

  • edited November 2017
    You haven't described much about the conditions that cause the player to get stuck.  Is he getting stuck on other NPCs / dynamic objects?  Some screenshots that show typical cases would be helpful in understanding what's going on.

    Is your game a point-and-click?  Aside from the NPCs, you don't generally need colliders in that case since the player will always only ever rely on the NavMesh.

    Also know that you don't have to rely on AC's pathfinding - attaching the NavMeshAgentIntegration component allows you to have characters rely on Unity's built-in navigation system.  And if you set a non-zero Pathfind update time value in the Settings Manager, it'll also recalculate pathfinding mid-movement.

    Unless you've modified it, the "Escape" key conflicting with the Pause menu is likely because the Pause Menu's Appear type is On Input Key.  For finer control over when and how it's enabled, you can set it to Manual and instead rely on Active Inputs.

    I agree that a "contingency" for character movement failing would be useful, however.  I'll take your suggestions into account, thanks for the feedback.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.