Forum rules - please read before posting.

Point-and-Click Navigation System

edited September 2015 in Technical Q&A
Hello,

first of all sorry for this silly question but i am newbie. :) So i have a problem about navigation system. I am developing a 2D side-scroll game and i can't use "polygon collider-navmesh system" properly because there's no area to move character back and forth just side-scrolling. I was using square sprites and box colliders in them as a component for the ground. How can i do that in Adventure Creator?

i am also submitting a picture of playground. Red line is suppose to be playground.

image

Comments

  • Welcome to the community, @Mdevotchka.

    If you're creating a side-scroller game with point-and-click controls, you'll still need to use a collider with depth (rather than just an edge/line) because you need to have a "catchment area" for the mouse clicks - even if it's very, very thin.

    Create a new NavMesh2D prefab from the scene manager, and then replace the PolygonCollider2D component with a BoxCollider2D.  Check Is Trigger? inside it, and then assign it as your Default NavMesh back in the Scene Manager.  You should find that it then behaves like a regular NavMesh.
  • Thanks for caring my problem @ChrisIceBox,

    So i applied your suggestion and it is mostly worked thanks for that. My character don't going absurd locations anymore and i understand the logic i guess. But one little problem is my character still can move a little top and down not moving on line. Because Box Collider2D can't go tinier more.. I need my BoxCollider2D a little bit tinier for a line effect as you explain. When i try to do tinier the collider a warning saying 

    "The collider did not create any collision shapes as they all failed verification. This could be because they were deemed too small or the vertices were too close. Vertices can also become close under certain rotations or very small scaling."

    Is there a way to solve this? Or this is unity's edges and won't let me go tinier collider.
  • Unity's collider system won't allow you to bring the vertices a certain distance together - this is a limitation of Unity in general.  You can get around this, however, by scaling up your graphics so that the scene itself is much better - and so the collider is smaller in relation.

    However, you might still find that the character is able to move up and down.  Characters animated with "Sprites Unity", which is a convenient option for most 2D games, are able to animate movement in all 4 compass directions.  However, for greater animation control, you should look into Sprites Unity Complex mode (covered in section 3.9 of the manual).  That mode will allow you to choose exactly how your character is animated - meaning you'll be able to set him up so that he can only animate left and right.
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.