Humanoid Control for Unity v4
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
Passer.Handle Class Reference

Description

Component to specify behaviour when grabbing a GameObject

A Handle can be used to give direction on how an object can be grabbed. A sword is usually grabbed by the hilt, a gun by the grip. When a Rigidbody with a Handle is grabbed, the Rigidbody will move into the hand such that the Handle will fit in the palm of the hand. When a static object with a Handle is grabbed, the hand itself will move such that the Handle fits in the palm of the hand.

Sockets

Humanoid hands actually have a socket inside which receives the handle. Sockets can also be used at different places to receive handles.

Events

%Controller Input

If a hand grabs an handle you can override the ControllerInput for the side of the hand which grabbed the handle during the time it is held. This enables you to assign a button to shoot a weapon when it is held for example. The configuration is similar to the normal ControllerInput. The difference is that empty entries do not override the ControllerInput configuration. When the handle is released by the hand, the ControllerInput is restored to the original configuration.

Inherits MonoBehaviour.

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

Public Types

enum  GrabType {
  DefaultGrab , BarGrab , BallGrab , RailGrab ,
  AnyGrab , NoGrab
}
 The way in which the hand can grab the handle More...
 
enum  Hand { Both , Left , 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
 
virtual void UpdateGrabbed ()
 
void OnTriggerEnter (Collider other)
 

Static Public Member Functions

static void Create (GameObject gameObject, Humanoid.HandTarget handTarget)
 
static Handle GetClosestHandle (Transform transform, Vector3 position, Hand hand, float range=float.PositiveInfinity)
 Finds the handle on the transform closest to the given position
 
static Handle GetClosestHandle (Transform transform, Vector3 position, float range=float.PositiveInfinity)
 Finds the handle on the transform closest to the given position
 
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
 
bool sticky = false
 Sticky handles will not release unless release sticky is used
 
float range = 0.2f
 The range within the handle will work. Outside this range normal grabbing is used.
 
ControllerEventHandlers[] controllerInputEvents
 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
 
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
 

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

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

◆ GetClosestHandle()

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

Finds the handle on the transform closest to the given position

Handles not in socket have lower priority

Member Data Documentation

◆ controllerInputEvents

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

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

Some handles may only be grabbed by the left or right hand.

◆ pose

Pose Passer.Handle.pose

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

See also: Hand Pose

◆ handTarget

Humanoid.HandTarget Passer.Handle.handTarget

The hand target which grabbed the handle.

When the Handle is grabbed this will contain the HandTarget of the grabbing hand. When the HandTarget of a Handle is set in the editor while editing the scene the applicable hand will try to grab the Handle. This is null when the handle is not grabbed by a hand.

◆ 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"
}

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