Forum rules - please read before posting.

Hiding a character behind a wall

I would like to hide a character behind a wall and to do this, I created an extra wall object that simply covers the character by setting the order in layer high enough (it's a 2D game). The problem is that you can still interact with the character, which is not ideal.

The manual mentioned something about adding a collider to the object, but that just introduces a whole lot of different problems (character gets stuck on the wall etc). Is there a simple way of hiding character behind a wall which would also "block" the interaction?

Comments

  • Check Is Trigger on the Collider. A Trigger will block raycasts, but not interfere with collisions.

  • Hmm, that doesn't seem to have any affect.

    I simply dragged in the wall sprite in the scene, added PolygonCollider2D and I covered the wall sprite with it. I checked Is Trigger and I set the Order in Layer high enough, so that the character disappears behind the wall. When character is behind the wall, the cursor still highlights, the name of the character still shows up when I go over it's hotspot, and you can still interact with the character.

    AC Version: 1.65.2
    Unity: 2018.2.18f1

  • The "order in layer" of the sprite won't affect it's interactivity - or that of anything behind it. That's purely visual.

    Try affecting it's position in the Z-axis so that it's closer to the camera.

  • That was it. Perfect, thank you!

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.