Forum rules - please read before posting.

Two observations on 2d demo

edited April 2016 in Engine development
Hello, I'm studying AC following the various tutorials.
I have found two oddities:
in the 2d demo, when creating the box collider and hotspot of the bird a popup warns me that these two components must be placed on the sprite child and not on the root object. But in my case the message is incorrect because everything runs smoothly on the root object. If I use the sprite child, hotspot is only found on the sides as if the circle collider would cover the hotspot.
The other oddity is that by setting the sprites sorting layer as suggested by the demo Brain remains under ParkGround that instead it must be set between -4 and -1 ( instead of 0, while Brain stays at 0).
I misunderstood something?
Unity Personal 5.3.0f4 and AC 1.51d
Thanks

Valter

Comments

  • Posts like this belong in Technical Q&A in future.

    NPC component
    The NPC script / trigger collider should normally go on the sprite child because it will always be facing the camera, whereas the root object will be rotating in 3D space.  The bird in the demo can have them on the root because it's uni-directional - it doesn't rotate over the course of the game.

    The Circle Collider and Box Collider can occupy the same space - but the Box Collider (which the NPC script makes use of as the "click area" must have "Is Trigger" checked.

    Sorting layer
    Brain's Order in layer should only be either 1, 3 or 6 as he moves around the scene when the game is running as he follows the Sorting Map.  Is he 0 for the whole time in your scene?  You can try playing the 2D demo online to see if there's a difference.
  • I'm sorry, I posted here because I thought, perhaps wrongly, that there was something to fix.
    Proceeding to study many things become clear but at first for beginners following tutorials can happen that they encounters some difficulties.

    For example Sorting Layer:
    following the tutorial we set Order in layers as suggested but when, at minute 15:34, we launch the game in your tutorial Brain moves ahead of everything but in my case Brain remains below ParkGround because Sorting Map has not yet been set. Brain and ParkGround have Order in layer = 0.
    Maybe you say it in the tutorial but unfortunately I can not translate well everything.

    Instead NPC component:
    at minute 47.26 a popup warns that Hotspot and Box Collider must be placed on the child and not on the root object as in the demo but if I do this when I run the game the bird's hotspot works only on the sides. Trying to leave components on the root object is operating normally (as you say in your comment, but then the popup confuses some ideas)

    In any case, proceeding in the study, these are details.
    Thanks for your great support and patience.
  • No problem at all.  But I think there is a confusion here because you seem to be referring to the 2D tutorial as opposed to the 2D demo.  While these do share the same graphics, they are still separate projects.

    Sorting Layer
    If two sprites are on the same Order in layer, and same depth from the camera, then Unity seems to pick which one to display first at random.  The SortingMap takes care of this issue, but you can just set Brain's layer to 1 in the meantime to ensure he's above it.

    NPC component
    Apologies, I was confused because I thought you were referring to the 2D Demo.  The NPC component should be on the root, but the Hotspots (and Box Collider 2D trigger) shoult be on the sprite child.  This was because Unity made a fundamental change to the 2D physics system after the tutorial was published.  Don't forget that you can also use the Character Wizard to have AC place the components for you.
  • You're right, I made a mistake talking about the 2D demo... I actually was referring to the tutorial.
    Thank you for your explanations.
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.