Hey Chris/everyone
I have a few scripts that use
if (Input.GetButtonDown("Fire1"))
or
void OnMouseDown()
Which means when you click on the object anywhere in the room (while first person) it will trigger the script. However I want it to only trigger when it's within AC's raycast limits I have set for Hotspots.
EG
I have a OnMouseDown() script on a mug. This script makes it jump into the air. However I only want it to trigger when you get close enough that the AC hotspot triggers the UI "mug". At the moment you can click on it and it will trigger wherever you are in the room.
Ideal world It would be great something like
if AC.hotspotactivated
{
whatever
}
My only two solutions at the moment is to call the script via an action list using the hotspot component
OR
Set up separate raycast within the script
Both of these would probably work, but a little convoluted.
If you need any more info feel free to ask.
Cheers
Jacob
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
To get an API reference for any Manager field, right-click on the field's label. In the case of the Settings Manager's Hotspot ray length field, it's:
Plugging that into your Raycast's distance parameter would sync it up with AC's raycasting.
However, if you still allow for regular interacting with Hotspots due to clicks, you can alternatively hook into the OnHotspotInteract custom event to trigger custom code when a given Hotspot is interacted with.
Here's an example script. Attach it to a Hotspot, and it will print a Debug statement whenever that particular Hotspot is interacted with:
Legend thank you, will test this out soon.
Works a treat, thank you!