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?
Intergrating with Opsive UTPC controller, selectable not finding NPC?
-
- Posts: 5
- Joined: Mon Jul 01, 2019 12:48 pm
Re: Intergrating with Opsive UTPC controller, selectable not finding NPC?
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:
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.
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:
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.
-
- Posts: 5
- Joined: Mon Jul 01, 2019 12:48 pm
Re: Intergrating with Opsive UTPC controller, selectable not finding NPC?
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.
- Attachments
-
- Capture.png (176.36 KiB) Viewed 656 times
Re: Intergrating with Opsive UTPC controller, selectable not finding NPC?
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?
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?
-
- Posts: 5
- Joined: Mon Jul 01, 2019 12:48 pm
Re: Intergrating with Opsive UTPC controller, selectable not finding NPC?
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.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?
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.
Re: Intergrating with Opsive UTPC controller, selectable not finding NPC?
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.
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.