Skip to content

Commit

Permalink
fix(ui): show omniseeker ui (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xenira committed Feb 4, 2024
1 parent a9596ad commit 3f773bd
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions plugin/src/MainGamePatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ void Start()
new SaveNotificationPatch(),
new HudPatch(),
new ProductionTerminalPatch(),
new OmniseekerPatch(),
]).ToArray();

Logger.LogDebug("Hello World!");
Expand Down
30 changes: 30 additions & 0 deletions plugin/src/patch/main_game/ui/OmniseekerPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using TechtonicaVR.Input;
using TechtonicaVR.UI;
using UnityEngine;

namespace TechtonicaVR.Patches.MainGame.UI;

class OmniseekerPatch : GameComponentPatch<OmniseekerUI>

{
protected override bool Apply(OmniseekerUI component)
{
var tlc = component.transform;
if (tlc == null)
{
return false;
}

var trackedCanvas = tlc.gameObject.AddComponent<HandTrackedCanvas>();
trackedCanvas.hand = SteamVRInputMapper.rightHandObject.GetComponentInChildren<Scanner>()?.transform;
trackedCanvas.showDirection = (Vector3.forward + Vector3.left).normalized;
trackedCanvas.offset = new Vector3(0.08f, -0.03f, -0.1f);
trackedCanvas.showDistance = 0.3f;
trackedCanvas.rectTransform = tlc.GetChild(0).GetComponent<RectTransform>();
trackedCanvas.transformOverride = new Vector3(100, 450, 550);

tlc.localScale = new Vector3(-0.1f, 0.1f, 0.1f);

return true;
}
}

0 comments on commit 3f773bd

Please sign in to comment.