How to make the GUI stop shaking and drag smoothly

When I use the CreateFullscreenUI and linkWithMesh it to the mesh, when I drag the lens, I can see the position change of the GUI. It will perform multiple calculations to make it look like shaking. Is there any way to make it move smoothly?https://playground.babylonjs.com/#XCPP9Y#20

What device are you testing it with? This playground seem to run smoothly on my computer.

I can see what Murongming is talking about - I’m on desktop chrome.

If you try zooming in -

Looks like because it uses pixel coordinates possibly that is causing it?

I sadly can’t reproduce this. The movement is very smooth when I move the camera

I noticed you are using 4.0.3. Any reason you are not trying on latest stable?

I tried in the latest stable and still the same -

chrome-capture

I think this is what murongming is referring too?

seems like it! Mind if I ask what the FPS when you move the camera?

FPS is 60, the gif is just has a low frame-rate

To be honest it’s pretty hard to notice unless you are really looking

When you say zooming in you mean the browsers actual zoom feature? CTRL-Space? I wouldn’t recommend using it :slight_smile:

But I guess I get what you are saying. This is probably because of some sort of floating point rounding or the conversation between 2D and 3D space. Maybe @msDestiny14 can elaborate more

Just to be sure, @murongming - is this really the issue?

1 Like

Hello, I didn’t zoom in. I found that the location of the GUI will be calculated many times when I move. When I stop moving, the location of the GUI is still updated. It looks inertial,When the ground is too large, it will be more obvious。Pay attention to its position

yes ,That’s what I’m talking about

Every time you move the camera it should calculate a new position because it is linking to a mesh in 3D space. I wonder if change will look more dramatic based on how far away the camera is to the object? .

Here it is, a more dramatic example. There are many objects in my scene, they all need to add highlight layers and GUI, at the same time, the whole scene needs to be rotated continuously. However, rotation causes very badly shake. Is there any way to optimize it?

Hi,
I believe you would need a new approach to this. It’s unlikely it will work like this in a near future (my opinion only).
There’s been a fair amount of discussions in this forum around this. Solutions around dynamicTexture and shader seem to be the best fit.
I particularly like this (fairly recent) approach to it created and shared by our gui-angel @carolhmj :angel: :wink:

Other topics that might be of interest to you:

I hope any of this will help you find your solution/make decision :dizzy_face: :wink: Meanwhile, have a great day :sunglasses:

2 Likes

I do get way better performance when projecting manually to screen space, instead of using linkWithMesh:

Just toggle boolean to test fps of both approaches. Nevertheless, as @mawa said there are better approaches.

1 Like

Oh, thank you. A nice work-around approach (taking advantage of BJS’s ‘versatility’ :grin: :wink:)
I like your thinking :hugs: …but I guess you know that by now :wink: Have an awesome day :sunglasses:

1 Like

Thank you for giving me some useful rerefence, i’ll have a look, have a nice day too!

Thank you for your thinking!