Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(input): add finger tracking #139

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ name: release-please
env:
MOD_NAME: "techtonica_vr"
PI_UTILS_VERSION: "0.2.0"
TTIK_VERSION: "0.1.4"
TTIK_VERSION: "0.2.0"
TOBEY_UNITY_AUDIO_VERSION: "2.0.2"

jobs:
Expand Down
8 changes: 5 additions & 3 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ifndef::env-github[]
endif::[]
:icons: font
:source-highlighter: highlightjs
:game-version: 0.2.1c
:game-version: 0.3.0-e
:repo: Xenira/TechtonicaVR

image:https://img.shields.io/github/v/release/{repo}["GitHub release (with filter)", link="https://github.com/{repo}/releases/latest"]
Expand Down Expand Up @@ -64,6 +64,8 @@ endif::[]

* Version {game-version} of the game. As the game is still in early access, this mod may not work with future versions of the game. If you encounter any issues, please create an https://github.com/{repo}/issues[Issue].
* https://github.com/BepInEx/BepInEx[BepInEx] version BepInEx Version
* https://github.com/Xenira/PiUtils[PiUtils] mod. Is included in the github release and as as an external dependency in the thunderstore release.
* https://github.com/Xenira/TTIK[TTIK] mod. Is included in the github release and as an external dependency in the thunderstore release.

== Setup

Expand Down Expand Up @@ -120,6 +122,7 @@ While the mod is in a playable state, it is still in early development. Some fea
- Controller haptics
- Smooth turning
- UI
- IK with coop support (https://github.com/Xenira/TTIK[TTIK])

=== Missing
- Gesture support (e.g. Mining using pickaxe motion)
Expand All @@ -137,7 +140,6 @@ While the mod is in a playable state, it is still in early development. Some fea

=== Cool stuff to try
- Tobii eye tracking for dynamic foveated rendering
- Enable ik (The game ships with `FinalIK` so it should be possible. Probably just not networked yet.)

== Configuration
The configuration file is located in `BepInEx/config/de.xenira.techtonicavr.cfg`. You can edit it using a text editor like Notepad.
Expand Down Expand Up @@ -223,7 +225,7 @@ I don't like NexusMods. I don't like their ToS and I don't like their mod manage
== License
This mod is licensed under the GNU General Public License v3.0 (GPL-3.0).

Contents of the `unity` and `libs` folders are licensed under their respective licenses.
Contents of the `unity`, `tools` and `libs` folders are licensed under their respective licenses.

== Disclaimer
This mod is not affiliated with the game's developers Fire Hose Games, Unity Technologies or Valve Corporation. All trademarks are the property of their respective owners.
201 changes: 0 additions & 201 deletions README.md

This file was deleted.

2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dependencies": [
"BepInEx-BepInExPack-5.4.2100",
"3_141-PiUtils-0.2.0",
"3_141-TTIK-0.1.4",
"3_141-TTIK-0.2.0",
"Tobey-UnityAudio-2.0.2"
]
}
4 changes: 2 additions & 2 deletions plugin/TechtonicaVr.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="2.*" />
<PackageReference Include="techtonica-libs" Version="0.3.0-e" />
<PackageReference Include="PiUtils" Version="0.*" />
<PackageReference Include="TTIK" Version="0.*" />
<PackageReference Include="PiUtils" Version="0.2.0" />
<PackageReference Include="TTIK" Version="0.2.0" />
<!-- <PackageReference Include="UnityEngine.Modules" Version="5.6.0" IncludeAssets="compile" /> -->
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions plugin/src/TechtonicaVR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@

[BepInPlugin("de.xenira.techtonicavr", MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
[BepInProcess("Techtonica.exe")]
[BepInDependency("de.xenira.ttik")]
[BepInDependency("de.xenira.pi_utils")]
[BepInDependency("de.xenira.ttik", "0.2.0")]
[BepInDependency("de.xenira.pi_utils", "0.2.0")]
[BepInDependency("Tobey.UnityAudio", BepInDependency.DependencyFlags.SoftDependency)]
public class TechtonicaVR : BaseUnityPlugin
{
private static PluginLogger Logger;

Check warning on line 29 in plugin/src/TechtonicaVR.cs

View workflow job for this annotation

GitHub Actions / build

'TechtonicaVR.Logger' hides inherited member 'BaseUnityPlugin.Logger'. Use the new keyword if hiding was intended.

Check warning on line 29 in plugin/src/TechtonicaVR.cs

View workflow job for this annotation

GitHub Actions / build

'TechtonicaVR.Logger' hides inherited member 'BaseUnityPlugin.Logger'. Use the new keyword if hiding was intended.
public static string gameExePath = Process.GetCurrentProcess().MainModule.FileName;
public static string gamePath = Path.GetDirectoryName(gameExePath);
public static string HMDModel = "";
Expand Down Expand Up @@ -123,8 +123,8 @@

Logger.LogDebug("Adding XRLoader to XRManagerSettings");
general.Manager = managerSettings;
managerSettings.loaders.Clear();

Check warning on line 126 in plugin/src/TechtonicaVR.cs

View workflow job for this annotation

GitHub Actions / build

'XRManagerSettings.loaders' is obsolete: ''XRManagerSettings.loaders' property is obsolete. Use 'XRManagerSettings.activeLoaders' instead to get a list of the current loaders.'

Check warning on line 126 in plugin/src/TechtonicaVR.cs

View workflow job for this annotation

GitHub Actions / build

'XRManagerSettings.loaders' is obsolete: ''XRManagerSettings.loaders' property is obsolete. Use 'XRManagerSettings.activeLoaders' instead to get a list of the current loaders.'
managerSettings.loaders.Add(xrLoader);

Check warning on line 127 in plugin/src/TechtonicaVR.cs

View workflow job for this annotation

GitHub Actions / build

'XRManagerSettings.loaders' is obsolete: ''XRManagerSettings.loaders' property is obsolete. Use 'XRManagerSettings.activeLoaders' instead to get a list of the current loaders.'

Check warning on line 127 in plugin/src/TechtonicaVR.cs

View workflow job for this annotation

GitHub Actions / build

'XRManagerSettings.loaders' is obsolete: ''XRManagerSettings.loaders' property is obsolete. Use 'XRManagerSettings.activeLoaders' instead to get a list of the current loaders.'
managerSettings.InitializeLoaderSync();

XRGeneralSettings.AttemptInitializeXRSDKOnLoad();
Expand Down
2 changes: 0 additions & 2 deletions plugin/src/ik/IkSetup.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using PiUtils.Objects.Behaviours;
using PiUtils.Util;
using TechtonicaVR.Input;
using TechtonicaVR.VRCamera;
using TTIK.Network;
using UnityEngine;
using Valve.VR;
using Valve.VR.InteractionSystem;

namespace TechtonicaVR.Ik;
Expand Down
33 changes: 33 additions & 0 deletions plugin/src/input/SteamvrInputMapper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System;
using PiUtils.Util;
using TTIK.Ik.FingerTracking;
using TTIK.Network;
using UnityEngine;
using Valve.VR;

Expand Down Expand Up @@ -82,6 +85,33 @@ public static void MapActions()

SteamVR_Actions._default.PoseLeft.AddOnUpdateListener(SteamVR_Input_Sources.Any, LeftHandUpdate);
SteamVR_Actions._default.PoseRight.AddOnUpdateListener(SteamVR_Input_Sources.Any, RightHandUpdate);

SteamVR_Actions._default.SkeletonLeftHand.AddOnChangeListener(UpdateLeftSkeleton);
SteamVR_Actions._default.SkeletonRightHand.AddOnChangeListener(UpdateRightSkeleton);
}

private static void UpdateLeftSkeleton(SteamVR_Action_Skeleton skeleton)
{
UpdateSkeleton(HandType.Left, skeleton);
}

private static void UpdateRightSkeleton(SteamVR_Action_Skeleton skeleton)
{
UpdateSkeleton(HandType.Right, skeleton);
}

private static void UpdateSkeleton(HandType left, SteamVR_Action_Skeleton skeleton)
{
if (NetworkIkPlayer.localInstance == null)
{
return;
}

var curls = skeleton.GetFingerCurls();
for (var i = 0; i < curls.Length; i++)
{
NetworkIkPlayer.localInstance.UpdateFingerCurl(left, (FingerType)i, curls[i]);
}
}

public static void UnmapActions()
Expand All @@ -94,6 +124,9 @@ public static void UnmapActions()

SteamVR_Actions._default.PoseLeft.RemoveOnUpdateListener(SteamVR_Input_Sources.Any, LeftHandUpdate);
SteamVR_Actions._default.PoseRight.RemoveOnUpdateListener(SteamVR_Input_Sources.Any, RightHandUpdate);

SteamVR_Actions._default.SkeletonLeftHand.RemoveOnChangeListener(UpdateLeftSkeleton);
SteamVR_Actions._default.SkeletonRightHand.RemoveOnChangeListener(UpdateRightSkeleton);
}

private static void HandleSteamVRMove(SteamVR_Action_Vector2 fromAction, SteamVR_Input_Sources fromSource, Vector2 axis, Vector2 delta)
Expand Down
Loading