Page 1 of 1

Selector distance from game object

Posted: Thu Jul 22, 2021 9:29 am
by thecodehermit
Hi again. I have been following the quick start tutorial and have a bit of an issue modifying it so that the conversation is triggered only when the player is within certain range from the npc. What I have now is

1 player with selector script attached. It also has the "distance from" set to "game object". Also I set the "actor transform" to the player's one.

1 NPC with Dialogue system trigger and Usable scripts.

I assumed that by checking the "distance from" to "game object" the conversation will trigger only when the player is within range, but what I get is the same functionality as before. If the camera is within the specified range then the conversation triggers.

I know I can put a proximity selector, but then I would have to be adjusting trigger colliders of each NPC.

Re: Selector distance from game object

Posted: Thu Jul 22, 2021 11:42 am
by Tony Li
Hi,

Distance From = GameObject checks the distance from the Selector's GameObject to the Usable. Here's a patch that adds the option Distance From = Actor Transform:

DS_SelectorPatch_2021-07-22.unitypackage

This addition will also be in the next full release (2.2.19).

Re: Selector distance from game object

Posted: Thu Jul 22, 2021 2:58 pm
by thecodehermit
Hmm so I was correct in thinking it tracks the selectors gameobject... Weird that it still tracked the camera distance and not the gameobject. Btw does it work as expected on your machine ?

Even after I implemented the patch it still tracks the camera position. Though I did had 3 errors after importing it. I commented out those 3 lines and tested it then.
error.png
error.png (37.58 KiB) Viewed 512 times

Re: Selector distance from game object

Posted: Thu Jul 22, 2021 3:30 pm
by Tony Li
Hi,

Are you perhaps using an old version of the Dialogue System? If so, can you back up your project, update to the current version, and then import the patch?

If you set Distance From to Actor Transform, then if the raycast hits a Usable it will compute the distance between the Usable and the Actor Transform. (However, the raycast itself always runs from the camera to the Select At position.)

Re: Selector distance from game object

Posted: Thu Jul 22, 2021 4:31 pm
by thecodehermit
Ohhh I am a dumb dumb xD updated everything, tried your script and even created new project and started testing there..
I thought selector distance was the distance from character to NPC, but it is actually the max range the raycast will run from the camera to the mouse... And the max use distance is what I was looking for.
Anyway thanks for the help and sry for bothering you. In any case your plugin has one of the best support from all the unity assets out there.

Re: Selector distance from game object

Posted: Thu Jul 22, 2021 4:36 pm
by Tony Li
Thanks! I'm glad you got to the bottom of the issue.