Interaction Pointer

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

Active Activates and shows the Focus Point Object. It will update the Focus Point Object's Transform and Line Renderer if available.
Timed Click Automatically initiates a click when an Object is in focus for the set amount of seconds. The value 0 disables this function.
Focus Point Object this is the GameObject which represents the focus point of the Interaction Pointer  when it is active.
Object in Focus this is the object to which the Interaction Pointer is pointing at. Is updated at runtime.
Mode The 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 Distance This determines the maximum distance in units you can reach with the curve.
Resolution The 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 Distance The maximum length of the curve in units.
Resolution The number of segments of the curve. Higher gives are smoother curve but requires more performance.
Speed the 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 Distance The distance the sphere is cast.
Radius The 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.

Active this function is called based on the value of the Active parameter of the Interaction Pointer.
Click this function is called based on the status of the click.
Focus this 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:

PointerDown is sent to the object in focus when the click starts
PointerUp is sent to the object in focus when the click ends
PointerClick is sent to the object when a click has been completed
PointerEnter is sent to an object when it comes into focus of the Interaction Pointer
PointerExit is sent to an object when it no longer is in focus of the Interaction Pointer
BeginDrag is sent to the object in focus when a click has started and the focus point starts to move
Drag is sent to the object in focus while the focus point changes during a click
EndDrag is 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.