Forum rules - please read before posting.

NavMesh search direction: Straight Down from cursor... is not straight down. :-D

I'm developing a side-scroller adventure game.

I want the player to be able to click anywhere on the screen and walk in that direction, stopping at the X coordinate of the clicked point.

To that effect, I've created elongated polygon NavMeshes. They're not very thin to allow for some vertical movement, but for the most part, the only movement I'm interested in is horizontal.

Now... taken from the manual...:

"There are several options related to how the player's destination when clicking is determined. The NavMesh search % (in the Settings Manager) allows you to choose how far from the cursor the game will search for a NavMesh, if one was not clicked on directly. If this is greater than zero, you can use the NavMesh search direction to determine if the search is conducted radially outward from the cursor, or straight down."

This is why I thought I should pick "Straight Down From Cursor" as the NavMesh search direction.

My expectations were that if I click at a point over the player character, she would remain basically in place, as the cursor would be horizontally positioned only some pixels away, either to the left or right.

But that's not happening. See this capture...:


She walks far to the left, instead of just turning a bit and keep in place.

And in other instances, she keeps in place, but goes either down, when she's at the upper limit, or she goes up when she's down. And my expectation there would be for her to always stay at the top of the NavMesh limit.

All in all, it doesn't seem the destination is well calculated, or at least not as I expected from reading the manual, that is.

These are my settings:


Am I mistaken about how this works?

Thank you!


  • Another interesting bit of info I've just find out...: the higher I click, the more to the left she goes.

    Almost proportionally, I'd say. Like if she goes to the left the same amount of pixels that the cursor is away from the NavMesh...

    Does this help...?
  • What versions of AC and Unity?  Let's see your Camera settings and the camera that's active too.

    I'm afraid your screenshot is not too clear to me - please don't crop images.  Where is the pointer clicking in the image?

    What you're expecting is indeed what should be occuring - the 2D Demo has this behaviour.  Please load up the 2D Demo in your project and check that it behaves how you're expecting.
  • Hi Chris,

    I've tried with the demo and it works flawlessly, as we both expected.

    My versions are Unity 5.5.3f1 (64 bit) and AC 1.56g. They've been like this for months, as I don't like to upgrade anything unless strictly necessary.

    The screenshot... yeah, I should have modified it to explain where I clicked there so... here:


    And as you see, the target is located on the far left.

    About the cameras, I have ProCamera 2D running with several parallax sub-cameras... maybe I should have mentioned that before... 8-}

    Take a look...



    ... this goes on...


    I've deactivated "Forward Focus", "Limit Distance", "Numeric Boundaries" and "Parallax" components, but it does the same: as high as you click over the toon, the more it goes to the left. The curious thing is that it works fine if you click just a little to the left or right of that "column", you see.

    Well, this seems to be an incompatibility problem between ProCamera 2D and AC... a shame really, as that camera plugin is stellar.

    I'll try to do more troubleshooting when I can and for the meantime, I think I'll put an empty hotspot over there so people can click above the toon without her going nuts. :P

    Thank you!
  • And if you remove all ProCamera components, does it then work?

    Custom camera components are certainly possible - but you must do it the right way.  Please see Section 4.6 of the Manual - such components must not be added to your MainCamera, but instead kept separate and made "visible" to AC by attaching the "_Camera" component.

    Once your component structure is set up correctly, we can then see about any compatibility issues there may be.
  • Hi Chris,

    I've made a backup of my project and physically removed all the PC2D components and additional cameras I had...:


    ...and even removed all PlayMaker FSMs from the Main Camera itself...:


    ...but it's doing the same! What the hell...

    I obviously get a lot of layers not being rendered, but the important one (Default) it is and I can still test if the toon stays in place if you click above her. And no, she still goes to the far left.

    The only thing I don't have in this test setup is a NavCam. Is it necessary for the game to behave like it should?

    Well, I don't really know what could it be if it's not related to PC2D. It's like if Raycasting was picking different world coordinates when I click over her...

    I'll revise other gameobjects (canvas especially) and see if they're in the UI layer or not.

    Thank you for your support.
  • edited July 2017
    I apologise for your frustration, but we will get to the bottom of it.

    Yes, you should make sure the MainCamera is attached to a GameCamera before anything else.  Also be sure to click Revert at the top of the MainCamera, so that it is set to the original state of the prefab.

    That the 2D Demo works for you is encouraging - there must be some key
    element in your own game that has been overlooked.  This means, however, that we can use the 2D Demo to compare any differences, which should help us isolate the problem.  Try the following experiments:

    1) Place the 2D Demo's player, Brain2D, into your scene and run it.  Does he also move to the wrong place?

    2) Load the 2D Demo's scene, Park, without re-assigning your Managers so that your own Managers are running while the 2D Demo runs.  This way, we can determine if the issue lies with your Managers.

    3) Then, try the opposite - load the 2D Demo's Managers into your AC window, and run your own scene.  This way, we can determine if the issue lies with your scene.

    Bear in mind that this is all temporary - we can re-introduce your removed elements later.  This can all be done in a separate temporary project if you prefer.
  • Thank you Chris.

    I'll need to let this pass for a while though, so I could focus on continuing with other features we need to publish before all is good and dandy. ;-)

    So see you in some days/weeks from now.
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.