A TapHandler is a class that can be used to detect when a GameObject has been tapped. In order for a GameObject to be tappable, it must also have a Collider component attached to the same GameObject as the TapHandler or to a parent GameObject.
Properties
Event fired when the tap handler is activated. Connect to this event to add custom behavior when the tap handler is tapped. Event Parameters: Position: the position on the TapHandler's collider that was tapped.
If CheckDistance is enabled, the character must be within this distance of the tap handler when it is tapped for it to activate. If move to is enabled, if the character is too far away, they will move within this distance of the TapHandler and then activate it.
Returns true if the tap handler has anchors
If the character has to move to activate the move handler, this is the position the character will move to. This is the position of the move target if it exists, otherwise it is the tap handler's position.
If CheckDistance is enabled, when a tap handler is tapped and the character is outside the tap handler's distance, the character will move to the TapHandler and activate it if MoveTo is true. If MoveTo is false, nothing happens.
Methods
Returns the closest anchor to the given world position
Activates the TapHandler as if it had been tapped.
Parameters
position
The position on the tap handler's collider that was tapped.
Returns
Updated 7 days ago