Skip to content

Commit

Permalink
fix(proxyHandModule): Fix for redundant hand/finger view models
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgejgnz committed Nov 22, 2020
1 parent ba428a0 commit 6cefe80
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Runtime/Modules/ProxyHand/ProxyHandController.cs
Expand Up @@ -49,6 +49,7 @@ private void Update()
{
if (model.configuration != null)
{
/*
for (int h = 0; h < model.hands.Length; h++)
{
if (model.hands[h] == model.master && !model.updateValuesForMaster)
Expand All @@ -62,6 +63,10 @@ private void Update()
UpdateHand(model.hands[h], viewModel.hands[h], model.configuration);
}
*/

UpdateHand(model.master, viewModel.master, model.configuration);
UpdateHand(model.slave, viewModel.slave, model.configuration);

if (model.slave)
{
Expand Down
34 changes: 32 additions & 2 deletions Runtime/Modules/ProxyHand/ProxyHandHandler.cs
Expand Up @@ -77,7 +77,19 @@ HandViewModel[] GetHandViewModelsArray()
for (int h = 0; h < model.hands.Length; h++)
{
if (model.hands[h] != null)
handViewModelsList.Add(new HandViewModel(model.hands[h]));
{
if (model.hands[h] == model.master)
handViewModelsList.Add(master);

else if (model.hands[h] == model.slave)
handViewModelsList.Add(slave);

else if (model.hands[h] == model.ghost)
handViewModelsList.Add(ghost);

else
handViewModelsList.Add(new HandViewModel(model.hands[h]));
}
}

return handViewModelsList.ToArray();
Expand Down Expand Up @@ -227,7 +239,25 @@ FingerViewModel[] GetFingerViewModelsArray()
for (int f = 0; f < model.fingers.Length; f++)
{
if (model.fingers[f] != null)
fingerViewModelsList.Add(new FingerViewModel(model.fingers[f]));
{
if (model.fingers[f] == model.thumb)
fingerViewModelsList.Add(thumb);

else if (model.fingers[f] == model.index)
fingerViewModelsList.Add(index);

else if (model.fingers[f] == model.middle)
fingerViewModelsList.Add(middle);

else if (model.fingers[f] == model.ring)
fingerViewModelsList.Add(ring);

else if (model.fingers[f] == model.pinky)
fingerViewModelsList.Add(pinky);

else
fingerViewModelsList.Add(new FingerViewModel(model.fingers[f]));
}
}

return fingerViewModelsList.ToArray();
Expand Down

0 comments on commit 6cefe80

Please sign in to comment.