Humanoid Control for Unity  v3
Passer.InteractionPointer Class Reference

A generic pointer to interact with objects in the scene using the Unity Event system. More...

Inheritance diagram for Passer.InteractionPointer:
Passer.Humanoid.Telegrabber Passer.Teleporter

Public Types

enum  RayType { Straight, Bezier, Gravity, SphereCast }
 The ray modes for interaction pointers. More...
 
enum  PointerType { FocusPoint, Ray }
 The type of interaction pointer More...
 

Public Member Functions

void LaunchRigidbody (Rigidbody rigidbody)
 
void LaunchPrefab (GameObject prefab)
 
void ApplyForce (float magnitude)
 
void Click ()
 Click on the objectInFocus More...
 
virtual void Click (bool clicking)
 Change the click status on the objectInFocus More...
 
virtual void Activation (bool _active)
 Change the active status of the InteractionPointer More...
 
virtual void ActivateClick (bool _active)
 

Static Public Member Functions

static InteractionPointer Add (Transform parentTransform, PointerType pointerType=PointerType.Ray)
 Adds a default InteractionPointer to the transform More...
 

Public Attributes

bool active = true
 Is the interaction pointer active? More...
 
float timedClick
 Automatically initiates a click when the objectInFocus does not change for the set amount of seconds. More...
 
GameObject focusPointObj
 The GameObject which represents the focus point of the Interaction Pointer when it is active. More...
 
GameObject objectInFocus
 The object to which the Interaction Pointer is pointing at. More...
 
RayType rayType = RayType.Straight
 The ray mode for this interaction pointer. More...
 
float maxDistance = 10
 The maximum length of the curve in units(meters) More...
 
float resolution = 0.2F
 The size of a segment in the curve More...
 
float speed = 3
 The horizontal speed for a gravity curve. More...
 
float radius = 0.1F
 The radius of the sphere in a SphereCast More...
 
GameObjectEventHandlers focusEvent
 Event based on the current focus. More...
 
Vector3EventList focusPointEvent
 Event based on the current focus. More...
 
GameObjectEventHandlers clickEvent
 Event based on the clicking status More...
 
BoolEvent activeEvent = new BoolEvent()
 Event based on the active status More...
 

Protected Member Functions

virtual void Awake ()
 
virtual InteractionModule CreateInteractionModule ()
 
virtual EventSystem CreateEventSystem ()
 
virtual void Start ()
 
virtual void Update ()
 
virtual void UpdateStraight ()
 
virtual void UpdateBezier ()
 
virtual Vector3[] UpdateBezierCurve (Transform transform, float maxDistance, out Vector3 normal, out GameObject focusObject)
 
Vector3 GetPoint (float t, Transform transform)
 
Vector3 GetVelocity (float t, Transform transform)
 
virtual void UpdateGravity ()
 
virtual void UpdateGravityCurve (Transform transform, float forwardSpeed, out Vector3 normal, out GameObject hitObject)
 
virtual void UpdateSpherecast ()
 
void UpdateFocus ()
 
void UpdateFocusPoint ()
 
virtual void OnDrawGizmosSelected ()
 

Protected Attributes

bool hasClicked = false
 
InteractionModule interactionModule
 
int interactionID
 
InteractionModule.InteractionPointer interactionPointer
 
LineRenderer lineRenderer
 The LineRender for this pointer when available. More...
 
float focusTimeToTouch = 0
 
float focusStart = 0
 
float heightLimitAngle = 100f
 
Vector3 startPosition = Vector3.zero
 
Vector3 intermediatePosition
 
Vector3 endPosition
 
GameObject previousObjectInFocus
 

Detailed Description

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.

Member Enumeration Documentation

◆ RayType

The ray modes for interaction pointers.

◆ PointerType

The type of interaction pointer

Member Function Documentation

◆ Add()

static InteractionPointer Passer.InteractionPointer.Add ( Transform  parentTransform,
PointerType  pointerType = PointerType.Ray 
)
static

Adds a default InteractionPointer to the transform

Parameters
parentTransformThe transform to which the Teleporter will be added
pointerTypeThe interaction pointer type for the Teleporter.

◆ Click() [1/2]

void Passer.InteractionPointer.Click ( )

Click on the objectInFocus

This function will do a full click: a button down followed by a button up.

◆ Click() [2/2]

virtual void Passer.InteractionPointer.Click ( bool  clicking)
virtual

Change the click status on the objectInFocus

Parameters
clickingIndicates if the button is down

Reimplemented in Passer.Teleporter.

◆ Activation()

virtual void Passer.InteractionPointer.Activation ( bool  _active)
virtual

Change the active status of the InteractionPointer

Parameters
_activeIndicates if the InteractionPointer is active

Member Data Documentation

◆ active

bool Passer.InteractionPointer.active = true

Is the interaction pointer active?

When an interaction pointer is active, it will actively point to objects. The objectInFocus will be updated based on the pointer. When a focusPointObj is set, this object will be set active. When a Line Renderer is set, the line renderer will be updated according to the properties of the pointer.

◆ timedClick

float Passer.InteractionPointer.timedClick

Automatically initiates a click when the objectInFocus does not change for the set amount of seconds.

The value 0 disables this function.

◆ focusPointObj

GameObject Passer.InteractionPointer.focusPointObj

The GameObject which represents the focus point of the Interaction Pointer when it is active.

If this is set and the pointer is active, the object will be objected based on the pointer's properties This GameObject will be disabled when the pointer is not active.

◆ objectInFocus

GameObject Passer.InteractionPointer.objectInFocus

The object to which the Interaction Pointer is pointing at.

This is updated at runtime while the pointer is active. The value is null when the pointer is not reaching any object.

◆ lineRenderer

LineRenderer Passer.InteractionPointer.lineRenderer
protected

The LineRender for this pointer when available.

◆ rayType

RayType Passer.InteractionPointer.rayType = RayType.Straight

The ray mode for this interaction pointer.

◆ maxDistance

float Passer.InteractionPointer.maxDistance = 10

The maximum length of the curve in units(meters)

This value is used for Straight, SphereCast and Bezier RayTypes

◆ resolution

float Passer.InteractionPointer.resolution = 0.2F

The size of a segment in the curve

Lower values will give a smoother curve, but requires more performance This value is used for Bezier and Gravity RayTypes

◆ speed

float Passer.InteractionPointer.speed = 3

The horizontal speed for a gravity curve.

A higher speed will reach further positions.

◆ radius

float Passer.InteractionPointer.radius = 0.1F

The radius of the sphere in a SphereCast

◆ focusEvent

GameObjectEventHandlers Passer.InteractionPointer.focusEvent
Initial value:
= new GameObjectEventHandlers() {
label = "Focus Event",
tooltip =
"Call functions using the current focus\n" +
"Parameter: the Object in Focus"
}

Event based on the current focus.

This event is generated from the objectInFocus. It has the objectInFocus as parameter. It can be used to execute functions when the focus changes between objects.

◆ focusPointEvent

Vector3EventList Passer.InteractionPointer.focusPointEvent
Initial value:
= new Vector3EventList() {
label = "Focus Point Event",
tooltip =
"Call functions using the current focus point\n" +
"Parameter: the position of the focus point"
}

Event based on the current focus.

This event is generated from the objectInFocus. It has the objectInFocus as parameter. It can be used to execute functions when the focus changes between objects.

◆ clickEvent

GameObjectEventHandlers Passer.InteractionPointer.clickEvent
Initial value:
= new GameObjectEventHandlers() {
label = "Click Event",
tooltip =
"Call functions using the clicking status\n" +
"Parameter: the Object in Focus when clicking"
}

Event based on the clicking status

This event is generated from the clicking boolean. It has the objectInFocus as parameter. It can be used to exectue functions when the user has clicked on an object.

◆ activeEvent

BoolEvent Passer.InteractionPointer.activeEvent = new BoolEvent()

Event based on the active status

This event is genereated from the active boolean Is has the active boolean as parameter. It can be used to execute functions when the interaction pointer is activated.


The documentation for this class was generated from the following file: