using System; using UnityEngine; namespace Leap.Unity { public class RigidHand : SkeletalHand { public override ModelType HandModelType { get { return ModelType.Physics; } } public override bool SupportsEditorPersistence() { return true; } public override void InitHand() { base.InitHand(); } public override void UpdateHand() { for (int i = 0; i < this.fingers.Length; i++) { if (this.fingers[i] != null) { this.fingers[i].UpdateFinger(); } } if (this.palm != null) { Rigidbody component = this.palm.GetComponent(); if (component) { component.MovePosition(base.GetPalmCenter()); component.MoveRotation(base.GetPalmRotation()); } else { this.palm.position = base.GetPalmCenter(); this.palm.rotation = base.GetPalmRotation(); } } if (this.forearm != null) { CapsuleCollider component2 = this.forearm.GetComponent(); if (component2 != null) { component2.direction = 2; this.forearm.localScale = new Vector3(1f / base.transform.lossyScale.x, 1f / base.transform.lossyScale.y, 1f / base.transform.lossyScale.z); component2.radius = base.GetArmWidth() / 2f; component2.height = base.GetArmLength() + base.GetArmWidth(); } Rigidbody component3 = this.forearm.GetComponent(); if (component3) { component3.MovePosition(base.GetArmCenter()); component3.MoveRotation(base.GetArmRotation()); } else { this.forearm.position = base.GetArmCenter(); this.forearm.rotation = base.GetArmRotation(); } } } public float filtering = 0.5f; } }