/// <summary> /// Method is triggered by "Grab" or similar method from current state of HandType /// </summary> /// <returns>new Leapstate or null to remain in current state</returns> public virtual State Activate(BaseTypeHnd h) { if (!owner) { owner = h; } return(new GodHand(this)); }
public override void Enter(BaseTypeHnd o) { handController = o; if (activeObj) { handController.SetActiveObject(activeObj); if (!activeObj.handIsVisible) { handController.HideHand(); } } }
public virtual void UpdateTransform(BaseTypeHnd t) { Vector3 grabOffsetPos = new Vector3(); Quaternion grabOffsetRot = Quaternion.identity; if (grabCenterOffset) { grabOffsetPos = grabCenterOffset.transform.position - transform.position; grabOffsetRot = grabCenterOffset.localRotation; } transform.position = t.transform.position - grabOffsetPos; transform.rotation = t.transform.rotation; transform.rotation *= grabOffsetRot; }
void Start () { handType = (BaseTypeHnd)Instantiate(handType, transform.position, Quaternion.identity); handType.SetOwner(this); handType.name = isRightHand ? "rightHand" : "leftHand"; GetComponent<Renderer>().enabled = false; // Disable visual indicator for Unityhand if (initialLeapObject) { initialLeapObject.gameObject.SetActive(true); handType.ChangeState(initialLeapObject.Activate(handType)); } originalPos = transform.localPosition; }
public virtual State Release(BaseTypeHnd h) { if (!isStatePersistent) { if (h && h.activeObj) { h.activeObj = null; } else { owner.activeObj = null; } owner = null; return(new GodHand()); // each object should return a state } return(null); }
public override void Enter(BaseTypeHnd o) { handController = o; handController.HideHand(); }