why need a npc with rigid body to work?
i try without this, but don't worked
proximity selector
Re: proximity selector
Hi,
Proximity Selector uses Unity's OnTriggerEnter and OnTriggerExit messages (or their 2D equivalents). Unity's physics requires rigidbodies. Here is a tutorial on Colliders as Triggers that you might find helpful.
You can use other techniques to start conversations and trigger other Dialogue System activity. But if you want to use Proximity Selector, you must set it up for Unity's physics.
Proximity Selector uses Unity's OnTriggerEnter and OnTriggerExit messages (or their 2D equivalents). Unity's physics requires rigidbodies. Here is a tutorial on Colliders as Triggers that you might find helpful.
You can use other techniques to start conversations and trigger other Dialogue System activity. But if you want to use Proximity Selector, you must set it up for Unity's physics.
- focusonfungames
- Posts: 17
- Joined: Thu Jun 07, 2018 10:21 pm
Re: proximity selector
I spent a fair bit of time trying to get the Proximity Selector working, myself. In the end, it was because I didn't have a Sphere Collider set as Trigger on my player game object. It's assumed in all of the documentation (I think) that the player has this set up. It's obvious, looking back, but until I figured this out, I was pretty stumped!
Re: proximity selector
Thanks for the feedback. I'll make sure to clarify that in the next update's documentation.
- focusonfungames
- Posts: 17
- Joined: Thu Jun 07, 2018 10:21 pm
Re: proximity selector
What I've seen other libraries, specifically VRTK, do is provide a public Collider variable attached to the script. If that value is null then the script creates a collider on that game object automatically/dynamically. This way, you can specify your own collider (likely you'll want to) but it'll still work the first time you run it even if you don't set it manually.
I assume your Proximity Selector script is doing a GetComponent<Collider> to grab the collider at run-time. Instead, it would just use the public Collider variable.
I assume your Proximity Selector script is doing a GetComponent<Collider> to grab the collider at run-time. Instead, it would just use the public Collider variable.
Re: proximity selector
VRTK requires things to work exactly one way. With the Proximity Selector, on the other hand, the trigger collider can be on the player or on the usable objects (e.g., NPCs). And if it's on the player, different devs want different size trigger colliders. For these reasons, it isn't practical to automatically add a collider to the player. However, I can update it to at least check for any kind of collider and log a message if it doesn't have anything.
- focusonfungames
- Posts: 17
- Joined: Thu Jun 07, 2018 10:21 pm
Re: proximity selector
Got it. Thanks!