Page 1 of 1

2D OnUse detection issues.

Posted: Sat Sep 24, 2022 11:32 pm
by Sean Sindahl
Hi, very impressive asset from the get-go, thumbs up on that part.

I've a conundrum though in getting it to work with my 2D setup. I'll try to be concise:

* OnUse with Select At (Mouse Position) works flawlessly. But my game does not use mouse during gameplay, so this is not an option.

* OnUse with Select At (Center of Screen) only works when the camera is literally touching the collider of the Selector. Max Selection Distance and Max Use Distance do literally nothing. Setting them to 9999 or any other value makes no difference. I've also tried all possible combinations of Distance From and nothing works. The OnUse collision will only trigger if the center of screen exactly touches the collider of the dialogue trigger. Is it bugged?

Either way, this option would not work regardless as I'm using a Cinemachine camera with custom bounds and movement that causes the camera to not always be centered, often leading to the center of the screen being slightly above or below the player, leading to the dialogue triggers to be slightly out of reach of the Selector colliders and never triggering. Not to mention that due to the selector distances not working, it forces the player to position themselves very precisely on the object they want to speak to, which is fully unacceptable.

* OnUse with Select At (Custom Position) seems to be the solution I want, but I cannot for the life of me figure out where or how to assign a Custom Point? If I could just get the Select At to follow my player transform (or a child game object on the player), I think I'd be good.

I've set Use 2D Physics. I've assigned the correct components (Dialogue System Trigger and Usable) to the NPC and the Selector on the player. Again, the only feature that works as intended is selecting at mouse position.

Re: 2D OnUse detection issues.

Posted: Sun Sep 25, 2022 3:35 pm
by Tony Li
Hi,

If Center Of Screen doesn't work, check the Usable's Use Distance. It probably needs to be higher.

However, it sounds like a Proximity Selector might be a better choice since Selector > Select At > Center Of Screen does a pinpoint raycast to the exact center of the screen. You can add a trigger collider to the camera that extends into the scene and make it as big as you like to give a margin of error to the detection.