Interaction Pointer

→ Interaction Pointer API

The interaction pointer is a generic pointer to interact with objects in the scene using the Unity Event system. The objects can receive and react on these interactions when an Unity Event Trigger component has been added to them. The Humanoid Teleporter is an specific implementation of an Interaction Pointer.

Setup

An interaction pointer can be added to any object. The objects Transform determines the starting position of the pointer and the pointer will always point in the direction of the Transform Forward.

Configuration

ActiveActivates and shows the Focus Point Object. It will update the Focus Point Object’s Transform and Line Renderer if available.
Timed ClickAutomatically initiates a click when an Object is in focus for the set amount of seconds. The value 0 disables this function.
Focus Point Objectthis is the GameObject which represents the focus point of the Interaction Pointer when it is active.
Object in Focusthis is the object to which the Interaction Pointer is pointing at. Is updated at runtime.
ModeThe ray mode for the pointer. See below for more information.

Straight mode

The straight mode will cast a ray from the Transform position in the forward direction until it hits an object.

Bezier mode

In bezier mode, a curve will be cast from the Transform position in the forward direction. The distance reached by this curve is limited. The curve is determine by the following parameters:

Maximum DistanceThis determines the maximum distance in units you can reach with the curve.
ResolutionThe number of segments of the curve. Higher gives are smoother curve but requires more performance.
Maximum DistanceThis determines the maximum distance in units you can reach with the curve.
ResolutionThe number of segments of the curve. Higher gives are smoother curve but requires more performance.

Gravity mode

In gravity mode, a curve will be cast from the Transform position in the forward direction. This curve follows a gravity path as if an object is launched. The curve can be configured with the following parameters:

Maximum DistanceThe maximum length of the curve in units.
ResolutionThe number of segments of the curve. Higher gives are smoother curve but requires more performance.
Speedthe horizontal speed determining the curve. A higher value can reach further positions.

Sphere mode

Is similar to the Straight mode, but casts a sphere instead of a ray. It has the following configuration parameters:

Maximum DistanceThe distance the sphere is cast.
RadiusThe radius of the sphere.

Input

The interaction pointer has three input events which can be used to call functions when the event occurs. More information on how to use this can be found on the Input page.

Activethis function is called based on the value of the Active parameter of the Interaction Pointer.
Clickthis function is called based on the status of the click.
Focusthis function is called based on the object in focus.

Focus Point Object

The Focus Point Object is disabled or enabled automatically when the Interaction Pointer is activated or deactivated.

The Transform of the target point object will be updated based on the ray curve to match the focus point of the Interaction Pointer. It will be aligned with the normal of the surface.

This object can be used to show the focus point of the interaction pointer in the way you like.

Line Renderer

When an line renderer is attached to the Focus Point Object, it will automatically be updated to show the line ray casting curve. You can change this line render to your likings. Only the positions will be overwritten when the Interaction Pointer is active.

Events

The following event of the Event System are currently supported:

PointerDownis sent to the object in focus when the click starts
PointerUpis sent to the object in focus when the click ends
PointerClickis sent to the object when a click has been completed
PointerEnteris sent to an object when it comes into focus of the Interaction Pointer
PointerExitis sent to an object when it no longer is in focus of the Interaction Pointer
BeginDragis sent to the object in focus when a click has started and the focus point starts to move
Dragis sent to the object in focus while the focus point changes during a click
EndDragis sent to the object in focus when the click ends after the focus point started to move

Functions

void Activation(bool active)can be used to activate the Interaction Pointer.
void Click(bool clicking)can be used to change the click state of the Interaction Pointer.