With help from @fatislord in this post, I call a method I created called OffsetHand right before DispatchUpdateFrameEvent in LeapServiceProvider
protected Frame OffsetHand(Frame f)
{
Vector3 pos = new Vector3(0, 0, 2.5f);
LeapTransform leapTransform = new LeapTransform(pos.ToVector(), LeapQuaternion.Identity);
if (f.Hands.Count > 0)
{
f.Hands[0].Transform(leapTransform);
}
return f;
}
Currently, I'm trying to add duplicate hands, I have tried adding Hands to the List in the Frame data as below.
protected Frame OffsetHand(Frame f)
{
Vector3 pos = new Vector3(0, 0, 2.5f);
LeapTransform leapTransform = new LeapTransform(pos.ToVector(), LeapQuaternion.Identity);
if (f.Hands.Count > 0)
{
Hand newHand = f.Hands[0];
newHand.Transform(leapTransform);
newHand.Id += 1;
f.Hands.Add(newHand);
pos = new Vector3(0, 0, 5f);
leapTransform = new LeapTransform(pos.ToVector(), LeapQuaternion.Identity);
Hand newHand2 = f.Hands[0];
newHand2.Transform(leapTransform);
newHand2.Id += 2;
f.Hands.Add(newHand);
print(f.Hands.Count);
}
return f;
}
However, no new Hands appear in the scene. The Hands.Count outputs 3. Where am I going wrong? Thanks for the help.