-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add client side gizmo #2279
Comments
Tagging @max-mrgrsk as I think that might mean I'll be able to assign him?! Also Max let me know what you think of this approach. For context max had also put together this proof of concept using r3f and drei, maybe we can use drei, but I'm not sure I want to add another dependency like r3f just for the gizmo, since we're currently using three.js directly, but I could be persuaded. |
Nope that didn't work, I think if you comment on the issue it might let me. |
@franknoirot I can see the new bottom right designs are used in a few places in figma, i.e. https://www.figma.com/file/5UUPOawPLEs3D0Gptf42vy/Designs?type=design&node-id=1%3A2&mode=design&t=V4U69BU5ETKwMNlk-1 But is there anything specific I should be linking to for the gizmo itself? |
@Irev-Dev I've created a small 200x200 canvas that hosts a tiny three.js scene with a cube dummy as a placeholder gizmo. The cube's orientation is currently synchronized with the client-side camera using Next, I will either integrate the capability to sync the gizmo's rotation based on server-side camera updates or adjust I like the idea of adjusting the engine > Afterwards I will integrate Plan B : in case if server will not like frequent requests and we will not reach desired smoothness, I could make the client-side camera to move from mouse drag. And use client-side camera mid-drag position for our gizmo. Both engine and client cameras would move simultniously and independently from each other(during drag). Kind of approximation. onMouseUp client-camera would snap in place, same as now. |
@Irev-Dev potentially the component in Figma to see its different UI states, but I haven't done a good pass of mocking up the different interactions I want the gizmo to have yet so that only really is helpful for gettingcontext about the other UI elements around the gizmo at the moment. I'll make a point to get those made up soon. Great start @max-mrgrsk thank you so much for contributing! I'll let @Irev-Dev comment on the camera sync approach. |
MAX! This is great, really happy you've been able to run with this. and apologies I've been slow to respond. We've got a catch up in an hour or so, so we'll talk about it there, but as far as feedback goes on your approach, my thoughts are that I would probably want to see your code at this point, that would help me reason about it. I think your experiments with update frequencies and lerping is perfect, is what I would have done to try and strike a balance. One other thing to note is that as far as commands that are sent to the engine we have two types reliable and unreliable. The reliable ones use TCP to ensure the packets make it through and are sent in order, but there's overhead which makes latency worse than our unreliable commands. In the case of the rotation here the break down is
I bring this up because at one point the engine folk had talked about sending back the camera details for all of the unreliable commands, but I can't remember where that got up to, I might double check on this one, because if we're able to get that data, it might mean we don't need to poll the engine, and potentially it will be lower latency as well. |
Oh and fwiw, if there's a bit of lag in the gizmo, I don't think that's the end of the world, idk what do you think @franknoirot ? |
Okay that data is definitely not coming through, I'll raise it with the engine team because I think that's probably the best. |
Okay @max-mrgrsk this diff here should be useful for getting updated camera data without having to poll If you want to integrate this into your work you can just copy the same code over, or if you want to use git and the git-cli If you do this the gizmo will be jittery in the short term, until I get something fixed in the engine. Screenshare.-.2024-05-09.4_10_34.PM.mp4 |
Thanks for the diff! I've implemented the changes and everything is working super smoothly now—really nice improvement! |
unreliableSubscriptions
nice Gizmo
Hi @franknoirot, I've implemented your designs for the gizmo. What do you think? |
This looks awesome @max-mrgrsk! I think your canvas size is I don't think you need to draw the blue ring in THREEjs, but could instead just give the canvas a round shape and a border, which could be accomplished with a wrapping rounded <div className="w-20 h-20 grid place-content-center rounded-full overflow-hidden border border-solid border-primary/50">
<canvas className="w-full h-full" {/* rest of canvas element's props... */} />
</div> That way that blue ring color updates along with all the others when the user's theme color is changed in their settings. We use TailwindCSS's standard sizing setup so |
* draft #2279 Add client side gizmo #2279, work in progress * draft #2279 unreliableSubscriptions * draft #2279 nice Gizmo * blue ring give the canvas a round shape and a border, wrapping rounded div element around the canvas * Refactor Gizmo Component Extracted reusable constants Modularized the code Simplified the useEffect logic Added TypeScript type annotations Improved overall code structure and readability * remove old gizmo * fmt * styling and relocation Add className "pointer-events-none" to gizmo wrapper div (for now to prevent context menu) Make LowerRightControls container element have these classNames: flex flex-col items-end gap-3 Move gizmo into LowerRightControls.tsx as the first child of the section element Remove the fixed styling from the gizmo div so it flows in flexbox * fmt * fix camera up problem * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * up tweak * Revert "up tweak" This reverts commit a53a0ef. * test tweak * tweak test --------- Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@kittycad.io>
There's a server-side gizmo, but there's problems in that because it's just some magic pixel's it makes it hard for us designing on the frontend to work around it, if we want to put other UI elements in the bottom-right-hand of the screen, we have to be carful to to cover it instead of using normal HTML layout techniques. This will also be something other clients would be interested in doing too.
I think the best approach is to make a small 300x300ish size canvas for the new gizmo to sit inside, and we just synce it with the rest of the scene's camera, this might mean integrating something like existing viewHelper trick to work with because it's not driven off orbit or similar controls, but instead camera details that come from the engine. But that might also be wrong since we already have utils set up for syncing between the engine camera and a three.js camera, but it doesn't happen mid-mouse-drag, so maybe if we make this update more frequent this would work.
Reading back over the above it's clear there's some quirks to our app that come from having a remote engine, I think it's best I outline the steps I think I would take to implement this. While it's most likely I'll get a few details wrong, it will give us a starting point and we can discuss hurdles as we hit them.
The text was updated successfully, but these errors were encountered: