-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Add ThirdPersonControls camera system #32386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
Implements a new third-person camera control system for three.js, following the patterns established by OrbitControls. The camera follows a target object, rotates around it using spherical coordinates, and includes collision avoidance via raycasting. Features: - Spherical coordinate-based camera positioning (theta, phi, radius) - Smooth camera movement with configurable damping - Automatic collision detection and avoidance - Target switching with optional smooth transitions - Auto-alignment behind moving targets - Configurable pivot offset for over-the-shoulder positioning - Full touch and pointer event support - Orthographic camera support Files added: - examples/jsm/controls/ThirdPersonControls.js - Main control class - examples/misc_controls_thirdperson.html - Interactive demonstration - docs/pages/ThirdPersonControls.html - Complete API documentation - examples/screenshots/misc_controls_thirdperson.jpg - Screenshot Files modified: - examples/jsm/Addons.js - Added export for ThirdPersonControls
|
TBH, I have seriously issues with all these AI generated PRs. And I share the concerns raised in #32370 (comment). Just because it is easy now to generate code, that does not mean we have to include all this stuff in this repository. The code still needs to be reviewed, understood, supported and maintained. Given the code quality of AI tools, it's irresponsible to blindly use the code. In apps in general and even more in libraries. I just observe that most of my time is now spend in reviewing such (low-quality) PRs and most of them are closed anyway. TBH, this is all SPAM to me since anyone can setup such PRs without even understanding the underlying concepts. I would prefer if users like @MuradAles file a issue first so it can be discussed if certain features should be added to the repository or not. E.g. there are existing libraries like https://github.com/pmndrs/ecctrl that are an ideal baseline for third-person controls. |
Doesn't work for me. Pressing space and toggle collision has no effect. A collision detection should be in general not implemented in a control class. |
|
I'm definitely not enjoying the mindless AI assisted PRs either. But I feel like there's a chance that some of these people could actually provide value and I'm giving them a chance whenever it feels like they're trying.
The code quality I'm getting out of them outperforms many of the contributors we've had over the years. The furnace test was fixed in less than an hour. Many contributors worked on and debated that issue for months/years in the past. Just this month alone I've managed to solve many issues we've not been able to fix for years because we've too much in our plate. So it's not a problem of the AI tools but a problem of how some humans are using them.
I feel like I'll end up writing a Chrome extension that reviews PRs automatically and classifies the PRs by code quality somehow. I'm surprised you haven't looked into that already. The only way to fight AI is with more AI.
That's how things were in the past and it was nice. But now things are different and I suspect that the only way to achieve that now would be by making the repo private and screen one by one every person that wants to contribute. |
Agreed. @MuradAles can you ask the AI to remove that feature? |
I agree the AI tools are powerful in the right hands. Only because they introduces some downsides, it does not mean to abandon them. I use Gemini quite regular e.g. as an advanced search and it's real help. I don't want to miss it anymore. However, the AI code quality I observe here and elsewhere is still a mixed bag (even when professionals provide proper input for the AI). Yes, sometimes it can be great, other times it's a complete failure. That's why I mean it must be reviewed and undestood. I'm still reserved by the trend to rely on too much AI. If we start to stop thinking ourselves, we end up with low-quality work overall. AI should be an assistant and not replace the expert. Unfortunately, I see it too often the other way around with serious consequences. |
Maybe we should write AI agents for ourselves and stop working altogether? IMO, too much AI quickly goes in the wrong direction. I understand there are strong speakers for AI in the coding community and the tech industry in general but you also observe a lot of AI-limitations are often ignored by such people. I think a more guided and controlled work with AI is a good middle way that should work out best. |
We just need a way to easily detect and nicely dismiss low effort PRs. Until GitHub does it for us 🤞 In the case of this PR, you can see that the person put some effort. We can then discuss what features we want or not. I used to worry a lot about maintenance but I don't worry so much now. I can learn everything pretty quickly and tweak it to the shape I want. My current goal is to make it easy for the AI to do Three.js stuff. I feel like it'd be harder for the AI to use ecctrl than to use a simpler class that's part of the examples. |
|
Hey there, I thought a simple third-person camera with just three parameters would be useful for people who want to quickly preview their character or object without dealing with big libraries. I used Opus 4.5 to speed things up. (Trying to be helpful) |
|
Hey there, I understand the feedback. I was only testing this on desktop, not on touch devices, so I can improve it and make the controls work better across different setups. I just wanted a simple control for users who do not want to download big libraries for basic testing, and I thought this small feature would be helpful. I will update it based on the comments. |
|
I don't believe some are being helpful. I'm not sure what the purpose is. but one just copied my PR to redo it in AI within the hour of submitting it. And they forked a tonne of projects within the past few days to create fake PRs so are spammers. For some things like a hack I had to do for a webkit audio api bug recently not available anywhere but now it is. vibe code won't have a clue. I don't find it useful at all and indexing bad code. There is 6th sense required designing some things and of course the design needs peers to discuss the best placement of something as it might not be the right placement. I had such a discussion with a PR to shaka player recently for adding an append event and figured it out in the end. AI won't be able to do that. How chatgpt titled and formatted the PR I am taking into account though. |
|
@Mugen87 I''ve just added this workflow that should protect |
|
@mrdoob Love it, thanks! Although the sentence "Please don't modify build files." somewhat became a punchline for me like "Have you tried turning it off and on again?" from the IT Crowd. A part of my inner self is maybe going to miss it^^. |



Add ThirdPersonControls Camera System
https://raw.githack.com/MuradAles/three.js/feature/pivot-point/examples/misc_controls_thirdperson.html
Description
Implements a new third-person camera control system for three.js, following the patterns established by OrbitControls. The camera follows a target object, rotates around it using spherical coordinates, and includes collision avoidance via raycasting.
This addresses the gap in three.js's camera control ecosystem by providing a game-ready third-person camera system commonly used in action and adventure games.
Features
Files Added
examples/jsm/controls/ThirdPersonControls.js- Main control classexamples/misc_controls_thirdperson.html- Interactive demonstration scenedocs/pages/ThirdPersonControls.html- Complete API documentationexamples/screenshots/misc_controls_thirdperson.jpg- Screenshot for examples galleryFiles Modified
examples/jsm/Addons.js- Added export for ThirdPersonControlsTesting