Instance set changes

Additional animator parameters
Reworked rigidbodies
Update to latest LeapC and LeapCSharp
This commit is contained in:
SDraw 2024-07-20 11:13:51 +03:00
parent 1f0b518761
commit 075ff67304
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
38 changed files with 8310 additions and 8646 deletions

View file

@ -13,6 +13,7 @@ namespace LeapInternal
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Threading;
using UnityEngine;
public class Connection
{
@ -1195,11 +1196,7 @@ namespace LeapInternal
return new UnityEngine.Vector3(ray.x, ray.y, ray.z);
}
/// <summary>
/// Converts from image-space pixel coordinates to camera-space rectilinear coordinates
///
/// Also allows specifying a specific device handle and calibration type.
/// </summary>
[Obsolete("calibType is not necessary. Please use the alternative PixelToRectilinearEx method.")]
public UnityEngine.Vector3 PixelToRectilinearEx(IntPtr deviceHandle,
Image.CameraType camera, Image.CalibrationType calibType, UnityEngine.Vector3 pixel)
{
@ -1216,6 +1213,24 @@ namespace LeapInternal
return new UnityEngine.Vector3(ray.x, ray.y, ray.z);
}
/// <summary>
/// Converts from image-space pixel coordinates to camera-space rectilinear coordinates
///
/// Also allows specifying a specific device handle and calibration type.
/// </summary>
public UnityEngine.Vector3 PixelToRectilinearEx(IntPtr deviceHandle,
Image.CameraType camera, UnityEngine.Vector3 pixel)
{
LEAP_VECTOR pixelStruct = new LEAP_VECTOR(pixel);
LEAP_VECTOR ray = LeapC.LeapPixelToRectilinearEx(_leapConnection,
deviceHandle,
(camera == Image.CameraType.LEFT ?
eLeapPerspectiveType.eLeapPerspectiveType_stereo_left :
eLeapPerspectiveType.eLeapPerspectiveType_stereo_right),
pixelStruct);
return new UnityEngine.Vector3(ray.x, ray.y, ray.z);
}
/// <summary>
/// Converts from camera-space rectilinear coordinates to image-space pixel coordinates
/// </summary>
@ -1302,6 +1317,48 @@ namespace LeapInternal
Marshal.FreeHGlobal(buffer);
}
/// <summary>
/// Request the Extrinsic Camera Matrix
/// </summary>
public Matrix4x4 LeapExtrinsicCameraMatrix(Image.CameraType camera, Device device)
{
float[] data = new float[16];
try
{
eLeapRS result = eLeapRS.eLeapRS_Success;
if (device != null)
{
result = LeapC.LeapExtrinsicCameraMatrixEx(_leapConnection, device.Handle, camera == Image.CameraType.LEFT ?
eLeapPerspectiveType.eLeapPerspectiveType_stereo_left :
eLeapPerspectiveType.eLeapPerspectiveType_stereo_right, data);
}
else
{
result = LeapC.LeapExtrinsicCameraMatrix(_leapConnection, camera == Image.CameraType.LEFT ?
eLeapPerspectiveType.eLeapPerspectiveType_stereo_left :
eLeapPerspectiveType.eLeapPerspectiveType_stereo_right, data);
}
if (result != eLeapRS.eLeapRS_Success)
{
return new Matrix4x4(new Vector4(data[0], data[1], data[2], data[3]),
new Vector4(data[4], data[5], data[6], data[7]),
new Vector4(data[8], data[9], data[10], data[11]),
new Vector4(data[12], data[13], data[14], data[15])
);
}
}
catch (Exception e)
{
Debug.LogException(e);
}
return Matrix4x4.identity;
}
/// <summary>
/// Send a specific set of hints to hDevice, if this does not include previously set ones, they will be cleared.
/// </summary>