Humanoid Control for Unity  v3
Passer.Handle Class Reference

Component to specify behaviour when grabbing the GameObject More...

Inherits MonoBehaviour.

Inherited by Passer.Humanoid.BallHandle, Passer.Humanoid.BarHandle, and Passer.Humanoid.NoGrab.

Public Types

enum  GrabType {
  GrabType.DefaultGrab, GrabType.BarGrab, GrabType.BallGrab, GrabType.RailGrab,
  GrabType.AnyGrab, GrabType.NoGrab
}
 The way in which the hand can grab the handle More...
 
enum  Hand { Hand.Both, Hand.Left, Hand.Right }
 Which hand can pick up this handle? More...
 

Public Member Functions

Vector3 TranslationTo (Vector3 position)
 
Quaternion RotationTo (Quaternion orientation)
 
void ReleaseFromSocket ()
 Releases this handle from the socket More...
 
virtual void UpdateGrabbed ()
 
void OnTriggerEnter (Collider other)
 

Static Public Member Functions

static void Create (GameObject gameObject, Pawn.PawnHand controllerTarget)
 Move the rigidbody such that the handle is in the position More...
 
static void Create (GameObject gameObject, Humanoid.HandTarget handTarget)
 
static Handle GetClosestHandle (Transform transform, Vector3 position)
 Finds the handle on the transform closest to the given position More...
 
static Handle GetClosestHandle (Transform transform, Vector3 position, Hand hand)
 Finds the handle on the transform closest to the given position More...
 

Public Attributes

GrabType grabType
 Select how the hand will grab the handle More...
 
bool sticky = false
 Sticky handles will not release unless release sticky is used More...
 
float range = 0.2f
 The range within the handle will work. Outside this range normal grabbing is used. More...
 
ControllerEventHandlers[] inputEvents
 The Controller input which will be active while the Handle is grabbed. More...
 
Socket socket
 The socket holding the handle More...
 
Hand hand
 Selects which hand can pick up this handle More...
 
Pose pose
 The Hand Pose which will be active while the Handle is grabbed. More...
 
bool useNearPose
 
int nearPose
 
Humanoid.HandTarget handTarget
 The hand target which grabbed the handle. More...
 
bool isHeld
 The Handle is held by a socket More...
 
GameObjectEventHandlers grabbedEvent
 

Protected Member Functions

virtual void Update ()
 

Static Protected Member Functions

static Handle GetClosestHandle (Handle[] handles, Vector3 position, Hand hand)
 
static bool CheckHand (Handle handle, Hand hand)
 

Protected Attributes

Mesh gizmoMesh
 

Properties

Vector3 worldPosition [get]
 The position of the handle in world coordinates More...
 
Quaternion worldRotation [get]
 The rotation of the handle in world coordinates More...
 
bool rigidbodyIsKinematic [get, set]
 

Detailed Description

Component to specify behaviour when grabbing the GameObject

Member Enumeration Documentation

◆ GrabType

The way in which the hand can grab the handle

Enumerator
DefaultGrab 

Same as BarGrab.

BarGrab 

The hand will grab the handle in the specified position and rotation.

BallGrab 

The hand will grab the handle in the specified position, the rotation is free.

RailGrab 

The hand will grab the handle along the the specified position, the rotation around the rail is free.

AnyGrab 

The hand will grab the handle in any position or rotation.

NoGrab 

The hand cannot grab the handle or the gameObject.

◆ Hand

enum Passer.Handle.Hand
strong

Which hand can pick up this handle?

Enumerator
Both 

The handle can be picked up by any hand.

Left 

The handle can only be grabbed by the left hand.

Right 

The handle can only be grabbed by the right hand.

Member Function Documentation

◆ Create()

static void Passer.Handle.Create ( GameObject  gameObject,
Pawn.PawnHand  controllerTarget 
)
static

Move the rigidbody such that the handle is in the position

◆ GetClosestHandle() [1/2]

static Handle Passer.Handle.GetClosestHandle ( Transform  transform,
Vector3  position 
)
static

Finds the handle on the transform closest to the given position

◆ GetClosestHandle() [2/2]

static Handle Passer.Handle.GetClosestHandle ( Transform  transform,
Vector3  position,
Hand  hand 
)
static

Finds the handle on the transform closest to the given position

◆ ReleaseFromSocket()

void Passer.Handle.ReleaseFromSocket ( )

Releases this handle from the socket

Member Data Documentation

◆ grabType

GrabType Passer.Handle.grabType

Select how the hand will grab the handle

◆ sticky

bool Passer.Handle.sticky = false

Sticky handles will not release unless release sticky is used

◆ range

float Passer.Handle.range = 0.2f

The range within the handle will work. Outside this range normal grabbing is used.

◆ inputEvents

ControllerEventHandlers [] Passer.Handle.inputEvents
Initial value:
= {
new ControllerEventHandlers() { label = "Vertical", id = 0 },
new ControllerEventHandlers() { label = "Horizontal", id = 1 },
new ControllerEventHandlers() { label = "Stick Button", id = 2 },
new ControllerEventHandlers() { label = "Button 1", id = 3 },
new ControllerEventHandlers() { label = "Button 2", id = 4 },
new ControllerEventHandlers() { label = "Button 3", id = 5 },
new ControllerEventHandlers() { label = "Button 4", id = 6 },
new ControllerEventHandlers() { label = "Trigger 1", id = 7 },
new ControllerEventHandlers() { label = "Trigger 2", id = 8 },
new ControllerEventHandlers() { label = "Option", id = 9 },
}

The Controller input which will be active while the Handle is grabbed.

Version
v3

◆ socket

Socket Passer.Handle.socket

The socket holding the handle

This parameter contains the socket holding the handle when it is held by a socket.

◆ hand

Hand Passer.Handle.hand

Selects which hand can pick up this handle

◆ pose

Pose Passer.Handle.pose

The Hand Pose which will be active while the Handle is grabbed.

◆ handTarget

Humanoid.HandTarget Passer.Handle.handTarget

The hand target which grabbed the handle.

This is null when the handle is not grabbed.

◆ isHeld

bool Passer.Handle.isHeld

The Handle is held by a socket

◆ grabbedEvent

GameObjectEventHandlers Passer.Handle.grabbedEvent
Initial value:
= new GameObjectEventHandlers() {
label = "Grab Event",
tooltip =
"Call functions using the grabbing status\n" +
"Parameter: the grabbed object",
eventTypeLabels = new string[] {
"Nothing",
"On Grab Start",
"On Let Go",
"While Holding",
"While Not Holding",
"On Grab Change",
"Always"
},
fromEventLabel = "socket.gameObject"
}

Property Documentation

◆ worldPosition

Vector3 Passer.Handle.worldPosition
get

The position of the handle in world coordinates

◆ worldRotation

Quaternion Passer.Handle.worldRotation
get

The rotation of the handle in world coordinates


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