Forum rules - please read before posting.

Movement clicks not registering 100% of the time. (scaled sprite)

Hi.

I have an issue where my player wont react to movement clicks 100% of the time.
I am using a tiny navmesh with a tiny sprite that is scaled down using the sorting map. (far distance shot) and I guess that could factor in to my issues.

I have recorded a video here showing the problem.

i'm using an older version of AC 1.71.4
and my unity version is: 2019.3.11f1

Here are my movement settings in AC:
https://imgur.com/Y61awf1
**
Here are my Navmesh settings:**
https://imgur.com/3dilJUi

Comments

  • edited December 2021

    Firstly, test this scene with the latest release in a backup or duplicate project. v1.72.0 made improvements to the click accuracy of 2D NavMeshes.

    That may be enough to resolve it, but otherwise: what is the shape of the NavMesh? The size of the character isn't factored into clicks, but the NavMesh is.

    One workaround would be to increase the size/shape of the NavMesh, and then restrict Player pathfinding by giving all path points the same Y position. That could be done with the following:

    using UnityEngine;
    using AC;
    
    public class SnapPointsToY : MonoBehaviour
    {
    
        private void OnEnable () { EventManager.OnPointAndClick += OnPointAndClick; }
        private void OnDisable () { EventManager.OnPointAndClick -= OnPointAndClick; }
    
        private void OnPointAndClick (Vector3[] pointArray, bool run)
        {
            float startY = KickStarter.player.transform.position.y;
            for (int i = 0; i < pointArray.Length; i++)
            {
                pointArray[i] = new Vector3 (pointArray[i].x, startY);
            }
        }
    
    }
    
  • Thats awesome Chris!
    Do I apply the script to the Navmesh?

  • It doesn't reference any objects directly - you can place it anywhere in the scene. Though, additional tweaking may be necessary if you want to only have it take effect at certain times.

  • So December stress happened and it took me almost a month to update AC and try this. SORRY!

    First of all.

    Updating AC really made a huge difference with click accuracy. Wow!
    This I guess kinda solves my problems. (thanks for this)

    But as for the script. i'm not not getting any errors when using it but im prob doing something wrong anyways.
    I have increased the navmesh to encompas a larger area. but the player behaves as it did before. I can walk Up and Down as usual.

    recorded a quick vid of my issue:

  • My mistake, I'm afraid: the script wasn't accounting for the player's original position.

    I've updated the post above rather than posting a new script, to avoid confusion for anyone re-visiting this thread in the future. Update your SnapPointsToY script to the above and it should now work.

  • It works perfectly! thanks!

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.