Implement wrist menu raycasting and trigger handling#1
Implement wrist menu raycasting and trigger handling#1
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!gamepad || !gamepad.buttons?.length) return false; | ||
| const button = gamepad.buttons[0]; | ||
| return (button.value ?? button.pressed ? 1 : 0) > TRIGGER_THRESHOLD; |
There was a problem hiding this comment.
Trigger threshold logic always evaluates as pressed
The nullish/ternary expression button.value ?? button.pressed ? 1 : 0 is parsed as (button.value ?? button.pressed) ? 1 : 0, so any defined analog value (even 0) evaluates as truthy and the function returns true on every frame a gamepad exposes button.value. This means clicking tools or drawing strokes triggers immediately even when the trigger is not pulled past TRIGGER_THRESHOLD. The condition should compare the analog value (or a button.pressed fallback) to the threshold before converting to boolean.
Useful? React with 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_68feeec995988326a4a6ac38fcee5675