Logic rewrite

Update to LeapCSharp 5.13.1
Not tested in VR
This commit is contained in:
SDraw 2022-09-02 13:44:03 +03:00
parent a41f17af82
commit 3609500959
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
21 changed files with 566 additions and 103 deletions

View file

@ -6,10 +6,12 @@
* between Ultraleap and you, your company or other organization. *
******************************************************************************/
using UnityEngine;
namespace Leap
{
using System;
#pragma warning disable 0618
/// <summary>
/// The Finger class represents a tracked finger.
///
@ -46,6 +48,7 @@ namespace Leap
/// received from the service.
/// @since 3.0
/// </summary>
[System.Obsolete("This signature will be removed in the next major version of the plugin. Use the one with Vector3 instead.")]
public Finger(long frameId,
int handId,
int fingerId,
@ -75,6 +78,42 @@ namespace Leap
IsExtended = isExtended;
TimeVisible = timeVisible;
}
/// <summary>
/// Constructs a finger.
///
/// Generally, you should not create your own finger objects. Such objects will not
/// have valid tracking data. Get valid finger objects from a hand in a frame
/// received from the service.
/// </summary>
public Finger(long frameId,
int handId,
int fingerId,
float timeVisible,
Vector3 tipPosition,
Vector3 direction,
float width,
float length,
bool isExtended,
FingerType type,
Bone metacarpal,
Bone proximal,
Bone intermediate,
Bone distal)
{
Type = type;
bones[0] = metacarpal;
bones[1] = proximal;
bones[2] = intermediate;
bones[3] = distal;
Id = (handId * 10) + fingerId;
HandId = handId;
TipPosition = ToVector(tipPosition);
Direction = ToVector(direction);
Width = width;
Length = length;
IsExtended = isExtended;
TimeVisible = timeVisible;
}
/// <summary>
/// The bone at a given bone index on this finger.
@ -125,6 +164,7 @@ namespace Leap
/// The tip position of this Finger.
/// @since 1.0
/// </summary>
[System.Obsolete("Its type will be changed from Vector to Vector3")]
public Vector TipPosition;
/// <summary>
@ -132,6 +172,7 @@ namespace Leap
/// as a unit vector pointing in the same direction as the tip.
/// @since 1.0
/// </summary>
[System.Obsolete("Its type will be changed from Vector to Vector3")]
public Vector Direction;
/// <summary>
@ -179,5 +220,13 @@ namespace Leap
TYPE_PINKY = 4,
TYPE_UNKNOWN = -1
}
[Obsolete("This will be removed in the next major version update")]
private Vector ToVector(Vector3 v)
{
return new Vector(v.x, v.y, v.z);
}
}
#pragma warning restore 0618
}