Hi there,
I'm trying to make it so the player can use objects by clicking on them, and I've set input to "Mouse 0". I've tried to start a conversation on the use of both a 2D and 3D object, both of which have colliders and a "usable" component.
From what I can tell the raycast is hitting the 3D object, but it's not working and I'm not sure why. Also, is there any way to use the raycast with a 2D sprite? Thanks.
Mouse Selection Trouble
Re: Mouse Selection Trouble
Hi Alex,
Assuming you're using a Selector component, here are some things to check:
In the Scene view (on the left), the yellow line is the raycast from the camera. It detected the NPC, Private Hart, so it drew a green sphere at the detection point.
Assuming you're using a Selector component, here are some things to check:
- Selector's Select At dropdown is set to "Mouse Position".
- The Layer Mask is correct to pick up the Usable that you're trying to detect.
- Max Selection Distance is high enough.
- For 2D:
- Select Tools > Pixel Crushers > Dialogue System > Welcome Window. Make sure the 2D Physics checkbox is ticked.
- Set your camera to Orthographic.
- Set the Selector's Run Raycasts dropdown to "In 2D".
- If you're mixing 2D and 3D, just use 3D colliders for everything.
In the Scene view (on the left), the yellow line is the raycast from the camera. It detected the NPC, Private Hart, so it drew a green sphere at the detection point.