using System; using UnityEngine; namespace Leap.Unity { public class RigidFinger : SkeletalFinger { private void Start() { for (int i = 0; i < this.bones.Length; i++) { if (this.bones[i] != null) { this.bones[i].GetComponent().maxAngularVelocity = float.PositiveInfinity; } } } public override void UpdateFinger() { for (int i = 0; i < this.bones.Length; i++) { if (this.bones[i] != null) { CapsuleCollider component = this.bones[i].GetComponent(); if (component != null) { component.direction = 2; this.bones[i].localScale = new Vector3(1f / base.transform.lossyScale.x, 1f / base.transform.lossyScale.y, 1f / base.transform.lossyScale.z); component.radius = base.GetBoneWidth(i) / 2f; component.height = base.GetBoneLength(i) + base.GetBoneWidth(i); } Rigidbody component2 = this.bones[i].GetComponent(); if (component2) { component2.MovePosition(base.GetBoneCenter(i)); component2.MoveRotation(base.GetBoneRotation(i)); } else { this.bones[i].position = base.GetBoneCenter(i); this.bones[i].rotation = base.GetBoneRotation(i); } } } } public float filtering = 0.5f; } }