Skip to content
This repository has been archived by the owner on Aug 3, 2024. It is now read-only.

Commit

Permalink
configurable watch position
Browse files Browse the repository at this point in the history
  • Loading branch information
galister committed Sep 14, 2023
1 parent b665d6e commit b3fa076
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
8 changes: 7 additions & 1 deletion Overlays/Watch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class Watch : BaseOverlay, IInteractable
private float _flBrightness = 1f;

internal LeftRight Hand;
internal Vector3 Vec3RelToHand = new(-0.05f, -0.05f, 0.15f);
internal Vector3 Vec3RelToHand;
internal Vector3 Vec3InsideUnit = Vector3.Right;

public bool Hidden;
Expand All @@ -33,6 +33,12 @@ public Watch(BaseOverlay keyboard) : base("Watch")
throw new InvalidOperationException("Can't have more than one Watch!");
_instance = this;

var relative_pos = Config.Instance.WatchPosition ?? new[] { -0.05f, -0.05f, 0.15f };
if (relative_pos.Length != 3)
throw new InvalidOperationException("watch_position must be an array of 3 floats!");

Vec3RelToHand = new Vector3(relative_pos[0], relative_pos[1], relative_pos[2]);

Hand = Config.Instance.WatchHand;
if (Config.Instance.WatchHand == LeftRight.Right)
{
Expand Down
4 changes: 3 additions & 1 deletion Resources/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ primary_hand: Right
## "Left" or "Right"
watch_hand: Left

## Position of the watch relative to controller pose. Y is inverted for right.
#watch_position: [ -0.05, -0.05, 0.15 ]

# The color of the pointer can be set 2 ways:
# - modifier bindings ("ClickModifierRight" and "ClickModifierMiddle")
# - hand orientation
Expand All @@ -132,7 +135,6 @@ middle_click_orientation: false
## Aims to help with double clicking.
click_freeze_time: 0.3


## Pointer & keyboard colors
#primary_color: '#006080'
#shift_color: '#B03000'
Expand Down
2 changes: 2 additions & 0 deletions Types/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ public static bool Load()

public bool FallbackCursors;

public float[]? WatchPosition;

public Dictionary<string, string> ExportInputs;

public Dictionary<string, string>? OverrideEnv;
Expand Down

0 comments on commit b3fa076

Please sign in to comment.