Skip to content

FirstPersonControls: Update interaction model.#33124

Merged
mrdoob merged 5 commits intodevfrom
controls
Mar 6, 2026
Merged

FirstPersonControls: Update interaction model.#33124
mrdoob merged 5 commits intodevfrom
controls

Conversation

@mrdoob
Copy link
Owner

@mrdoob mrdoob commented Mar 5, 2026

Description

Changed the interaction model so the camera orientation is controlled by dragging from the press point. The further you drag from where you pressed, the faster the camera rotates — like the original center-based approach but anchored to your press position instead of the screen center. This also adds mobile touch support via pointer events and uses setPointerCapture to handle pointer release outside the window. activeLook and handleResize() are no longer needed — the former has been removed and the latter replaced with a deprecated stub.

http://raw.githack.com/mrdoob/three.js/controls/examples/webaudio_sandbox.html
http://raw.githack.com/mrdoob/three.js/controls/examples/webgl_geometry_minecraft.html
http://raw.githack.com/mrdoob/three.js/controls/examples/webgl_geometry_terrain.html
http://raw.githack.com/mrdoob/three.js/controls/examples/webgl_shadowmap_performance.html

mrdoob and others added 2 commits March 5, 2026 17:27
…tas.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mrdoob mrdoob added this to the r184 milestone Mar 5, 2026
@mrdoob mrdoob marked this pull request as draft March 5, 2026 08:35
@mrdoob
Copy link
Owner Author

mrdoob commented Mar 5, 2026

Haven't tested mobile yet.

@mrdoob
Copy link
Owner Author

mrdoob commented Mar 5, 2026

Another option would be to change the lookAt based on the delta from the pointerdown position.
Like the previous beaviour except not hardcoded to the middle of the screen.

@Mugen87
Copy link
Collaborator

Mugen87 commented Mar 5, 2026

Haven't tested mobile yet.

Just tested the links on a Pixel 8a with Chrome and the controls don't work. The camera barely reacts on touch input. You just see a single tiny change in orientation when tapping on the display.

I would expect the camera moves towards the tapped location as long as you hold down the finger.

@mrdoob
Copy link
Owner Author

mrdoob commented Mar 5, 2026

Indeed, mobile is broken. Will fix later.

Instead of using movementX/movementY deltas, the rotation speed is now
based on the distance from the pointerdown position. This works like the
original center-based approach but anchored to where you pressed. Also
restores click-to-move-forward/backward and fixes mobile touch support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Mugen87
Copy link
Collaborator

Mugen87 commented Mar 6, 2026

Actually, I have just tested the current FirstPersonControls in production on my mobile phone and they have an issue as well. If you tap and then move the finger, the camera is transformed even if you lift the finger. That isn't right.

So it's good FirstPersonControls gets some care^^.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mrdoob mrdoob marked this pull request as ready for review March 6, 2026 13:40
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mrdoob mrdoob merged commit 2882df3 into dev Mar 6, 2026
9 checks passed
@mrdoob mrdoob deleted the controls branch March 6, 2026 14:37
@Mugen87
Copy link
Collaborator

Mugen87 commented Mar 6, 2026

This new interaction model really feels better than the previous one. Especially on mobile it feels "fixed".

I've noted this change in the migration guide with a link to this PR so users are informed.

@mrdoob
Copy link
Owner Author

mrdoob commented Mar 6, 2026

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants