Forum rules - please read before posting.

Bug: AC.NavigationEngine_PolygonCollider

ac1.52a
u5.3.5p8

Sometimes when I click on a hotspot I get this error and afterwards I can't move the player anymore.

It depends where I stand in the room.

IndexOutOfRangeException: Array index is out of range.
AC.NavigationEngine_PolygonCollider.GetPointsArray (Vector3 _originPos, Vector3 _targetPos, AC.Char _char) (at Assets/AdventureCreator/Scripts/Navigation/NavigationEngine_PolygonCollider.cs:117)
AC.ActionCharPathFind.Run () (at Assets/AdventureCreator/Scripts/Actions/ActionCharPathFind.cs:98)
AC.ActionList+<RunAction>c__Iterator2.MoveNext () (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:324)
UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress)
UnityEngine.MonoBehaviour:StartCoroutine(String, Object)
AC.ActionList:ProcessAction(Int32) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:288)
AC.ActionList:ProcessActionEnd(ActionEnd, Int32, Boolean) (at Assets/AdventureCreator/Scripts/ActionLis

Comments

  • And what is it about the parts of the room that work vs those that don't?  Showing screens of the NavMesh, and where you're trying to go, would help a lot.

    The problematic line in NavigationEngine_PolygonCollider reads:

    Vector3 vertex = new Vector3 (pointsList[i].x, pointsList[i].y, _originPos.z);

    Try inserting above it:

    if (pointsList.Length >= i) continue;

    What happens then?
  •  I sometimes get this error when the character has to go around that corner
    the blue X marks the walk to marker
    the hotspot is slighty out of the nash mesh at the corner
    and I can't reproduce the error all the time. It just happens sometimes.
    I played around a little with the nav mesh and repositioned the walk to marker a bit.
    For now the error doesn't occur anymore.
     But maybe it is something worth looking into because it might happen at some other corner in ac-games. or just add a couple of try catch into the code so in case something happens it does nothing and the user has to tap again 

    image



     when I add if (pointsList.Length >= i) continue; above
    then I get this when the player tries to go around the corner


    ArgumentOutOfRangeException: Argument is out of range.
    Parameter name: index
    System.Collections.Generic.List`1[UnityEngine.Vector3].get_Item (Int32 index) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:633)
    AC.NavigationEngine_PolygonCollider.GetPointsArray (Vector3 _originPos, Vector3 _targetPos, AC.Char _char) (at Assets/AdventureCreator/Scripts/Navigation/NavigationEngine_PolygonCollider.cs:123)
    AC.PlayerMovement.ProcessHit (Vector3 hitPoint, UnityEngine.GameObject hitObject, Boolean run) (at Assets/AdventureCreator/Scripts/Controls/PlayerMovement.cs:786)
    AC.PlayerMovement.RaycastNavMesh (Vector3 mousePosition, Boolean run) (at Assets/AdventureCreator/Scripts/Controls/PlayerMovement.cs:810)


    is it ok to have  markers outside of the nav mesh?
    never had a problem with it before. I need it because I teleport a lot outside of the visible area.


  • edited July 2016
    You should always try to place your any Marker the player can navigate to within the NavMesh boundary.  If one is outside, AC will instead attempt to make the player move to the edge of the NavMesh that's nearest to it - but will still keep the player within.
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.