Tag: Input
All the articles with the tag "Input".
Some Functions Read z as a Distance and Others Throw It Away
Code I clipped while trying to hide the cursor at the center of the screen in an FPS and raycast from that point to find where a shot lands. The original calls z a 'fix that puts the axis in camera terms'; the docs call it 'the distance of the resulting plane from the camera'. It's not a fix, it's a choice — and locking the cursor removes the need to read the value at all.
What Decides the Point to Look At Is the Plane, Not the Ray
Short code for facing the mouse, clipped while looking for how to do top-down controls. The method is right, but the plane sits at the origin and the height gets patched in separately. Put the plane at the object's position and that patch disappears.
What Sits Between started and performed Is the Press Threshold
The author of an Input System walkthrough left a question unanswered: why do started and performed behave identically? The answer isn't a frame, it's two thresholds — and the page that documents them contradicts itself in the same entry.
Why Enter Does Nothing in an InputField: The Condition Reads a Cache
Code written so a name can be entered by keyboard or by mouse — except the keyboard path does nothing until the mouse button has been clicked once. The condition reads a string cached in Awake, not the input field.