Forum rules - please read before posting.

Blocking hotspot mouseclicks when objects are "behind walls" in a 2D game

Dear all;

I have a scene in my 2D game in which the player walks inside a building, and the front wall is removed revealing a sort of cutaway of the inside of the building. There are several hotspots inside the building, and I'd like for these to be unclickable until the player is inside. Several iterations of AC ago I thought I'd got this working - I placed a big hotspot over the whole building that had no interactions set, and this seemed to block all the hotspots inside it, until it was turned off by an Object:Call Event action as the player enters the building.

At some point though, this approach seems to have stopped working. I've experimented with using a 2D Collision Cube prefab spawned from the scene manager and placed on the default layer, but this neither blocks mouseclicks and raycasts or responds to being turned on and off by Object: Call Event or Object: Send Message.

I am missing something here, or approaching this all the wrong way?

Cheers,

Martyn

Comments

  • edited May 2021

    You don't necessarily need a Collision Cube from the Scene Manager - mouse-clicks should be blocked by any 2D collider (Trigger and non-Trigger) placed on the Default layer.

    For a 2D game, however, the Z position is important - make sure that it's closer to the camera than the Hotspots you wish for it to block.

  • Thanks Chris, it was the Z position that nailed it!

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.