123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- 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<Rigidbody>();
- 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<CapsuleCollider>();
- 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<Rigidbody>();
- 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;
- }
- }
|