I recorded a video as I think this is the easiest way to demonstrate my issue:
I am using the Player Vicinity hotspot detection method. It works, but the hotspot activates way too early (the hotspot is supposed to be much further in the background so it should only activate when the player is way closer). I tried to remedy this by adding an interactive boundary to the hotspot, but as soon as I do that, the hotspot stops working completely. The player character has a hotspot detector GameObject attached with both a Rigidbody and a Collider, so this shouldn't be the problem. Does anyone know how I could fix this problem?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Welcome to the community, @tempuser123.
As the Player Vicinity mode relies on a 2D collider, it doesn't have a sense of the "depth" of the scene. In the case of a 2D scene with high depth contrast such as this, the use of an Interactive Boundary is the right way to go.
When used along with Player Vicinity, the effect should be compounded - i.e. the Hotspot should only be interative when both the Hotspot is in the Hotpot Detector, and the Player is in the Interactive Boundary.
I've used your video to attempt a quick recreation, and it does look like there's an issue here. I'll look further into this and get back to you - thanks for the report.
On my end, this occurs with the sample 2D Player because they do not have the physics components necessary to be detected by an Interactive Boundary.
To resolve this, attach a Rigidbody2D component to the Player's root, as well as a Circle Collider 2D. Make sure Ignore gravity? is checked in the Player component, and check Is Trigger in the Collider to prevent unwanted collisions.
In the upcoming v1.82 update, I'll add an option to the Interactive Boundary component to have it optionally read the Player's position directly, instead of needing these components.
Hi @ChrisIceBox, thanks for your response!
This does not seem to work for me unfortunately. I added both a Rigidbody2D and a Circle Collider 2D to the root player component (in this case, SamplePlayer2D). Weirdly the player is still being affected by gravity, even though the Ignore Gravity checkbox is checked. But more importantly the hotspot still does not seem to be triggered this way, unfortunately.
Update: I got it to work - I was using the player that is spawned by the PlayerStart2D at runtime and I was adding these components after starting the game (just for testing purposes), and that didn't work for some reason. Adding the actual player to the scene, however, with these components attached right from the start, fixed the problem. Thank you so much for your help!