Forum Discussion
gary.frewin
5 years agoExplorer
Bones list is empty
Hi Folks, Two questions: 1. My list of bones is always empty. I have an OVRhandprefab stored in a variable called skeleton. But when I call skeleton.Bones in my start method it always has a co...
- Anonymous5 years ago
You have to wait until the OVRSkeleton's Initialize method has finished before you can get the bones. The simplest way to do that is wait a frame before getting the bones. Since the Start method can be turned into a coroutine you can do that like this:
public class GetBones : MonoBehaviour { private OVRSkeleton skeleton; private Transform indexTipTransform; // Start is called before the first frame update IEnumerator Start() { skeleton = GetComponent<OVRSkeleton>(); while (skeleton.Bones.Count == 0) { yield return null; } foreach (var bone in skeleton.Bones) { if (bone.Id == OVRSkeleton.BoneId.Hand_IndexTip) { indexTipTransform = bone.Transform; } } } }Then if there's a particular part of the hand to you to get the position of you look for the bone.Id in the Bones list and store that part's transform (the foreach part above).
Anonymous
5 years agoYou have to wait until the OVRSkeleton's Initialize method has finished before you can get the bones. The simplest way to do that is wait a frame before getting the bones. Since the Start method can be turned into a coroutine you can do that like this:
public class GetBones : MonoBehaviour {
private OVRSkeleton skeleton;
private Transform indexTipTransform;
// Start is called before the first frame update
IEnumerator Start() {
skeleton = GetComponent<OVRSkeleton>();
while (skeleton.Bones.Count == 0) {
yield return null;
}
foreach (var bone in skeleton.Bones) {
if (bone.Id == OVRSkeleton.BoneId.Hand_IndexTip) {
indexTipTransform = bone.Transform;
}
}
}
}
Then if there's a particular part of the hand to you to get the position of you look for the bone.Id in the Bones list and store that part's transform (the foreach part above).
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 7 years ago
- 3 years ago