Humanoid Control for Unity  v3
Passer.Socket Class Reference

Sockets can hold a Handles. More...

Inheritance diagram for Passer.Socket:
Passer.Humanoid.HandSocket Passer.Pawn.ControllerSocket

Public Member Functions

void Attach (GameObject objectToAttach)
 
bool Attach (GameObject objectToAttach, bool rangeCheck)
 
bool Attach (Transform transformToAttach, bool rangeCheck=true)
 Tries to attach the given Transform to this socket More...
 
virtual bool Attach (Handle handle, bool rangeCheck=true)
 Tries to attach the given Transform to this socket More...
 
virtual void Release (bool releaseSticky=false)
 Releases a Transform from the socket More...
 
void OnDrawGizmosSelected ()
 

Static Public Member Functions

static Mesh GenerateGizmoMesh1 ()
 
static Mesh GenerateGizmoMesh ()
 

Public Attributes

GameObject attachedPrefab
 A prefab which is used to attach to the socket at startup. More...
 
Transform attachedTransform
 The Transform attached to this socket More...
 
Handle attachedHandle
 
string socketTag
 A tag for limiting which handles can be held by the socket More...
 
GameObjectEventHandlers attachEvent
 A GameObject Event for triggering changes in the Transform held by the Socket More...
 

Static Public Attributes

static bool debug = false
 

Protected Member Functions

virtual void MoveHandleToSocket (Transform socketTransform, Rigidbody handleRigidbody, Handle handle)
 
virtual void MoveHandleToSocket (Transform socketTransform, Handle handle)
 
virtual void MoveSocketToHandle (Transform socketTransform, Handle handle)
 
virtual void MoveSocketToHandle (Transform socketTransform, Rigidbody socketRigidbody, Handle handle)
 
virtual bool AttachRigidbody (Rigidbody objRigidbody, Handle handle, bool rangeCheck=true)
 
void AttachTransformParenting (Transform objTransform, Handle handle)
 
void AttachRigidbodyParenting (Rigidbody objRigidbody, Handle handle)
 
virtual void AttachRigidbodyJoint (Rigidbody objRigidbody, Handle handle)
 
virtual void AttachRigidbodyReverseJoint (Rigidbody objRigidbody, Handle handle)
 Attach handle to socket using a static joint on the handle More...
 
virtual void AttachSocketParenting (Rigidbody objRigidbody, Handle handle, Rigidbody socketRigidbody)
 
virtual void MassRedistribution (Rigidbody socketRigidbody, Rigidbody objRigidbody)
 
virtual bool AttachStaticObject (Transform objTransform, Handle handle)
 
virtual void AttachSocketParenting (Transform objTransform, Handle handle, Rigidbody thisRigidbody)
 
virtual void AttachStaticJoint (Transform objTransform)
 
virtual void ReleaseRigidbodyParenting (Rigidbody objRigidbody)
 
virtual void ReleaseRigidbodyJoint ()
 
void ReleaseRigidbodyReverseJoint ()
 
virtual void ReleaseSocketParenting (Rigidbody objRigidbody, Transform socketTransform)
 
virtual void MassRestoration (Rigidbody socketRigidbody, Rigidbody objRigidbody)
 
virtual void ReleaseStaticObject ()
 
virtual void ReleaseStaticJoint ()
 
void ReleaseTransformParenting ()
 
void ReleaseSocketParenting (Transform objTransform)
 
virtual void Update ()
 
void UpdateHolding ()
 

Protected Attributes

Transform releasingTransform
 
Transform attachedTransformParent
 The parent of the attached transform before it was attached More...
 
float originalMass = 1
 
bool originalUseGravity = false
 
Mesh gizmoMesh
 

Static Protected Attributes

static string[] attachEventTypeLabels
 

Properties

bool isOccupied [get]
 Does the socket currently have a handle attached? More...
 
virtual Vector3 worldPosition [get]
 

Detailed Description

Sockets can hold a Handles.

When a handle is within the range of the socket, it will be attached to the socket. The position and rotation of the Transform with the Handle will be changed such that the handle fits the position and rotation of the socket.

Member Function Documentation

◆ Attach() [1/2]

bool Passer.Socket.Attach ( Transform  transformToAttach,
bool  rangeCheck = true 
)

Tries to attach the given Transform to this socket

If the Transform has a Handle with the right Socket Tag it will be attached to the socket. Static and Kinematic Rigidbodies will be attached by parenting. Non-Kinematic Rigidbodies will be attached using a joint.

Parameters
transformToAttachThe Transform to attach to this socket
Returns
Boolean indicating whether attachment succeeded

◆ Attach() [2/2]

virtual bool Passer.Socket.Attach ( Handle  handle,
bool  rangeCheck = true 
)
virtual

Tries to attach the given Transform to this socket

If the Handle has the right Socket Tag it will be attached to the socket. Static and Kinematic Rigidbodies will be attached by parenting. Non-Kinematic Rigidbodies will be attached using a joint.

Parameters
handleThe Handle to attach to this socket
Returns
Boolean indicating whether attachment succeeded

Reimplemented in Passer.Humanoid.HandSocket, and Passer.Pawn.ControllerSocket.

◆ AttachRigidbodyReverseJoint()

virtual void Passer.Socket.AttachRigidbodyReverseJoint ( Rigidbody  objRigidbody,
Handle  handle 
)
protectedvirtual

Attach handle to socket using a static joint on the handle

◆ Release()

virtual void Passer.Socket.Release ( bool  releaseSticky = false)
virtual

Releases a Transform from the socket

Note that if the Transform is not taken out of the range of the socket or held by another Socket, it will automatically snap back to the Socket.

Reimplemented in Passer.Humanoid.HandSocket, and Passer.Pawn.ControllerSocket.

Member Data Documentation

◆ attachedPrefab

GameObject Passer.Socket.attachedPrefab

A prefab which is used to attach to the socket at startup.

◆ attachedTransform

Transform Passer.Socket.attachedTransform

The Transform attached to this socket

If the socket holds a Handle, this will contain the Transform of the Handle. It will be null otherwise

◆ attachedTransformParent

Transform Passer.Socket.attachedTransformParent
protected

The parent of the attached transform before it was attached

This is used to restore the parent when the transform is released again.

◆ socketTag

string Passer.Socket.socketTag

A tag for limiting which handles can be held by the socket

If set (not null or empty) only Handles with the given tag will fit in the socket.

◆ attachEventTypeLabels

string [] Passer.Socket.attachEventTypeLabels
staticprotected
Initial value:
= {
"Never",
"On Attach",
"On Release",
"While Attached",
"While Released",
"When Changed",
"Always"
}

◆ attachEvent

GameObjectEventHandlers Passer.Socket.attachEvent
Initial value:
= new GameObjectEventHandlers() {
label = "Hold Event",
tooltip =
"Call functions using what the socket is holding\n" +
"Parameter: the GameObject held by the socket",
eventTypeLabels = attachEventTypeLabels
}

A GameObject Event for triggering changes in the Transform held by the Socket

Property Documentation

◆ isOccupied

bool Passer.Socket.isOccupied
get

Does the socket currently have a handle attached?


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