Humanoid Control for Unity v4
|
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.
Humanoid hands actually have a socket inside which receives the handle. Sockets can also be used at different places to receive handles.
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... | |
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. | |
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. | |
Socket | socket |
The socket holding the handle. | |
Hand | hand |
Selects which hand can pick up this handle. | |
Pose | pose |
The Hand Pose which will be active while the Handle is grabbed. | |
bool | useNearPose |
int | nearPose |
Humanoid.HandTarget | handTarget |
The hand target which grabbed the handle. | |
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 |
The way in which the hand can grab the handle.
enum Passer.Handle.Hand |
|
static |
Finds the handle on the transform closest to the given position.
Handles not in socket have lower priority
ControllerEventHandlers [] Passer.Handle.controllerInputEvents |
The Controller input which will be active while the Handle is grabbed.
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 Passer.Handle.hand |
Selects which hand can pick up this handle.
Some handles may only be grabbed by the left or right hand.
Pose Passer.Handle.pose |
The Hand Pose which will be active while the Handle is grabbed.
See also: Hand Pose
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.
GameObjectEventHandlers Passer.Handle.grabbedEvent |