public void SetBehavior(SteamVR_Skeleton_PoserBehavior behavior) { this.behavior = behavior; // blendPoses = new SkeletonBlendablePose[behavior.skeletonAdditionalPoses.Count + 1]; blendPoses = new SkeletonBlendablePose[behavior.allPoses.Length]; for (int i = 0; i < blendPoseCount; i++) { blendPoses[i] = new SkeletonBlendablePose(GetPoseByIndex(behavior, i)); // blendPoses[i].PoseToSnapshots(); } blendingBehaviours.Clear(); for (int i = 0; i < behavior.blendingBehaviours.Count; i++) { blendingBehaviours.Add(new PoseBlendingBehaviour(behavior.blendingBehaviours[i])); } // NOTE: Is there a better way to get the bone count? idk // boneCount = behavior.skeletonMainPose.leftHand.bonePositions.Length; boneCount = behavior.allPoses[0].leftHand.bonePositions.Length; blendedSnapshotL = new SteamVR_Skeleton_PoseSnapshot(boneCount, HandType.LeftHand); blendedSnapshotR = new SteamVR_Skeleton_PoseSnapshot(boneCount, HandType.RightHand); }
protected void Awake() { if (previewLeftInstance != null) { DestroyImmediate(previewLeftInstance); } if (previewRightInstance != null) { DestroyImmediate(previewRightInstance); } blendPoses = new SkeletonBlendablePose[skeletonAdditionalPoses.Count + 1]; for (int i = 0; i < blendPoseCount; i++) { blendPoses[i] = new SkeletonBlendablePose(GetPoseByIndex(i)); blendPoses[i].PoseToSnapshots(); } boneCount = skeletonMainPose.leftHand.bonePositions.Length; // NOTE: Is there a better way to get the bone count? idk blendedSnapshotL = new SteamVR_Skeleton_PoseSnapshot(boneCount, SteamVR_Input_Sources.LeftHand); blendedSnapshotR = new SteamVR_Skeleton_PoseSnapshot(boneCount, SteamVR_Input_Sources.RightHand); }
protected void Awake() { if (previewLeftInstance != null) { DestroyImmediate(previewLeftInstance); } if (previewRightInstance != null) { DestroyImmediate(previewRightInstance); } blendPoses = new SkeletonBlendablePose[skeletonAdditionalPoses.Count + 1]; for (int i = 0; i < blendPoseCount; i++) { SteamVR_Skeleton_Pose iterPose = GetPoseByIndex(i); // ValheimVR Mod Edit: Potentially need to initialize here // to workaround serialized data not traveling with AssetBundle if (iterPose.leftHand.bonePositions == null) { Debug.Log("Initializing Left Hand Pose Data for index : " + i); HandResourceInitializer.Initialize_SteamVR_Skeleton_Pose_Hand(ref iterPose.leftHand, i, HandResourceInitializer.LEFT_HAND); } if (iterPose.rightHand.bonePositions == null) { Debug.Log("Initializing Right Hand Pose Data for index : " + i); HandResourceInitializer.Initialize_SteamVR_Skeleton_Pose_Hand(ref iterPose.rightHand, i, HandResourceInitializer.RIGHT_HAND); } blendPoses[i] = new SkeletonBlendablePose(iterPose); blendPoses[i].PoseToSnapshots(); } boneCount = skeletonMainPose.leftHand.bonePositions.Length; // NOTE: Is there a better way to get the bone count? idk blendedSnapshotL = new SteamVR_Skeleton_PoseSnapshot(boneCount, SteamVR_Input_Sources.LeftHand); blendedSnapshotR = new SteamVR_Skeleton_PoseSnapshot(boneCount, SteamVR_Input_Sources.RightHand); }