Intergrating with Opsive UTPC controller, selectable not finding NPC?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
ChargerIIC
Posts: 5
Joined: Mon Jul 01, 2019 12:48 pm

Intergrating with Opsive UTPC controller, selectable not finding NPC?

Post by ChargerIIC »

I was integrating the Dialogue System for Unity with my prototype leveraging Opsive's Ultimate Third Person Controller. I followed the steps in getting started and in the integration section, and everything seems to work except that if I approach an NPC I don't get the prompt to interact with them or the ability to start the conversation. As a test I even added the private Hart NPC from the integration, but no success. Any idea what I could be doing wrong?

Image

Image
User avatar
Tony Li
Posts: 22163
Joined: Thu Jul 18, 2013 1:27 pm

Re: Intergrating with Opsive UTPC controller, selectable not finding NPC?

Post by Tony Li »

Hi,

Tick the Selector's Debug checkbox. While you're on the Selector, make double check the Layer Mask.

Then open a Scene view that you can watch while playing in the editor's Game view. The Scene view will show a yellow line that indicates where it's looking for Usables. In the screenshot below, the yellow line runs from the player's camera through the mouse position. It hits Private Hart, who has a Usable component, so it shows a green sphere at the intersection point:

selectorDebug.png
selectorDebug.png (243.7 KiB) Viewed 717 times

Note that the Selector will stop if the mouse is over a UI element whose Raycast Target checkbox is ticked. If you have a UI panel that covers the whole screen, you may need to untick Raycast Target on the elements that shouldn't block the Selector.
ChargerIIC
Posts: 5
Joined: Mon Jul 01, 2019 12:48 pm

Re: Intergrating with Opsive UTPC controller, selectable not finding NPC?

Post by ChargerIIC »

This is driving me nuts. The selector's raycast is definitely missing the target most of the time, no matter if I use Center of Screen or Mouse Based detection. Its almost like there's some kind of force field around the target - the selector sweeps widely around I scan over the target. Is there a way to get the selector to raycast from my player object? It seems like the opsive camera is too unpredictable for the standard method.

Image
Attachments
Capture.png
Capture.png (176.36 KiB) Viewed 715 times
User avatar
Tony Li
Posts: 22163
Joined: Thu Jul 18, 2013 1:27 pm

Re: Intergrating with Opsive UTPC controller, selectable not finding NPC?

Post by Tony Li »

Hi,

To raycast from the player, you'll need to make a subclass of Selector and override the Run3DRaycast() method.

Is it possible that the ray is hitting something else, such as the player's colliders or a UI element?

Have you considered using Opsive's Interact ability instead of the Selector component?
ChargerIIC
Posts: 5
Joined: Mon Jul 01, 2019 12:48 pm

Re: Intergrating with Opsive UTPC controller, selectable not finding NPC?

Post by ChargerIIC »

Tony Li wrote: Tue Jul 02, 2019 9:17 am Hi,

To raycast from the player, you'll need to make a subclass of Selector and override the Run3DRaycast() method.

Is it possible that the ray is hitting something else, such as the player's colliders or a UI element?

Have you considered using Opsive's Interact ability instead of the Selector component?
You mentioned the Interact ability and that triggered something. The NPC from the demo has an interactable component but not a usuable component. After switching back to center of screen (with some adjustments for the Opsive's very swingy camera) and adding a usuable component I can now target and interact with an NPC I built myself as part of hte quick start guide.

Is it possible to just use Opsive's Interact ability? That would simplify things on my end if it works. The selector's raycasting works great with other third person view controllers but Opsive's seem to almost hate the idea of pointing directly at anything in the best of times.
User avatar
Tony Li
Posts: 22163
Joined: Thu Jul 18, 2013 1:27 pm

Re: Intergrating with Opsive UTPC controller, selectable not finding NPC?

Post by Tony Li »

If center of screen works, then mouse position might work, too.

As for Opsive's Interact ability, I'm sure it can do the same. I've only used it in the most basic manner simply as a way to trigger conversations, and I'm out of the office right now where I can't test it further. Try asking on the Opsive forum or discord server.
Post Reply