-
Notifications
You must be signed in to change notification settings - Fork 751
feat: CameraControls support for 1:1 events onX
callback props
#2451
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
onX
callbacks
onX
callbacksonX
callback props
OMG yes please <3 I tried out this PR and the problem remains. Specifically, I have the camera controlled via Installed this PR via "node_modules/@react-three/drei": {
"version": "0.0.0-semantic-release",
"resolved": "https://pkg.csb.dev/pmndrs/drei/commit/20225955/@react-three/drei",
"integrity": "sha512-csYgbtSOdZQJdLKg5GSU2iz4eBXh1Z2AQN1zpeEcg2TbG9GNnuGQdCAHgpmhDGM/r9sb4ZMOtMs17Lsbz4H8sg==",
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.26.0",
"@mediapipe/tasks-vision": "0.10.17",
"@monogrid/gainmap-js": "^3.0.6",
"@use-gesture/react": "^10.3.1",
"camera-controls": "^2.9.0",
"cross-env": "^7.0.3",
"detect-gpu": "^5.0.56",
"glsl-noise": "^0.0.0",
"hls.js": "^1.5.17",
"maath": "^0.10.8",
"meshline": "^3.3.1",
"stats-gl": "^2.2.8",
"stats.js": "^0.17.0",
"suspend-react": "^0.1.3",
"three-mesh-bvh": "^0.8.3",
"three-stdlib": "^2.35.6",
"troika-three-text": "^0.52.4",
"tunnel-rat": "^0.1.2",
"use-sync-external-store": "^1.4.0",
"utility-types": "^3.11.0",
"zustand": "^5.0.1"
},
"peerDependencies": {
"@react-three/fiber": "^9.0.0",
"react": "^19",
"react-dom": "^19",
"three": ">=0.159"
},
"peerDependenciesMeta": {
"react-dom": {
"optional": true
}
}
}, and here my package.json dependencies for context: package.json dependencies"dependencies": {
"@react-three/drei": "https://pkg.csb.dev/pmndrs/drei/commit/20225955/@react-three/drei",
"@react-three/fiber": "^9.1.0",
"r3f-perf": "^7.2.3",
"react": "^19.0.0",
"react-colorful": "^5.6.1",
"react-dom": "^19.0.0",
"sass": "^1.86.0",
"three": "^0.176.0",
"vite-plugin-mkcert": "^1.17.8",
"zustand": "^5.0.3"
},
"devDependencies": {
"@eslint/js": "^9.21.0",
"@gltf-transform/cli": "^4.1.3",
"@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4",
"@vitejs/plugin-react-swc": "^3.8.0",
"eslint": "^9.21.0",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-react-refresh": "^0.4.19",
"globals": "^16.0.0",
"gltfjsx": "^6.5.3",
"vite": "^6.2.0"
} |
🎉 This PR is included in version 10.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@FrostKiwi i have a clue looking at https://yomotsu.github.io/camera-controls/examples/rest-and-sleep.html: with that new release, can you try <CameraControls
onTransitionStart={() => invalidate()}
/> and tell me if it solves the issue with if yes i'll create a new pr for |
@FrostKiwi even without this trick @react-three/drei@latest solves the previous jerky anim issues i had same for you? |
No, it does not solve the problem. The camera still teleports to the destination. There was never a missing
That would be wonderful ❤
Yes, specifically when starting to interact with the camera, the very first movement used to result in a jerk, something that looked like a frame stutter, something I reported as Still, the camera teleports big distances because of #2005 (comment) in functions |
does userland's https://r3f.docs.pmnd.rs/advanced/scaling-performance#sync-animations-with-on-demand-rendering-and-invalidate prevent the issue? if yes it's probably good enough, right? |
Yes and no. But that doesn't cover all cases and AFAIK, that leaves one special case out: Scrollwheel, which is handled specially. Scrollwheel always results in small teleportation. From the doc: https://github.com/yomotsu/camera-controls/blob/dev/readme.md#events
|
supports all
onX
https://github.com/yomotsu/camera-controls/tree/dev?tab=readme-ov-file#events'controlstart'
'control'
'controlend'
'transitionstart'
enableTransition = true
'update'
'wake'
'rest'
.restThreshold
².'sleep'
onStart
/onEnd
/onChange
🐛 it also fixes a bug with
frameloop="demand"
where calling programmatic CameraControls methods caused a jerky animation
Before:
frameloop-before.mp4
After:
frameloop-after.mp4