Skip to content

Commit

Permalink
Guard against tracking glitches that effect painting (icosa-foundatio…
Browse files Browse the repository at this point in the history
…n#808)

* See if this prevents the glitching when CPU load is high
  • Loading branch information
andybak authored Jan 10, 2025
1 parent 111676a commit 7452de9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Assets/Scripts/Tools/FreePaintTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,15 @@ override public void AssignControllerMaterials(InputManager.ControllerName contr

void PositionPointer()
{
// Discard the pointer if the controller is exactly zero
// as it probably indicates the controller tracking stalled this frame
// TODO:Mikesky: See if can be done at input level
if (InputManager.m_Instance.GetControllerBehavior(InputManager.ControllerName.Brush).transform.position == Vector3.zero)
{
Debug.LogError($"Controller Glitch!");
return;
}

// Angle the pointer according to the user-defined pointer angle.
Transform rAttachPoint = InputManager.m_Instance.GetBrushControllerAttachPoint();
Vector3 pos = rAttachPoint.position;
Expand Down

0 comments on commit 7452de9

Please sign in to comment.