Is it possible to addControl the ScrollViewer with StackPanel3D?

I want to addControl the ScrollViewer with StackPanel3D and reflect it on the screen. Is it possible?
Or, on the contrary, I would like to addControl StackPanel3D with ScrollViewer and reflect it on the screen. Is it possible?

cc @DarraghBurke

Interesting question. Would you have an example of what you’re looking for.
Obviously, the ScrollViewer is a 2D controller. It won’t work in a 3D stackpanel. But there might be a go-around (there often is :smiley:) We would just need to understand what the final result should look like?…

1 Like

Going to +1 this. If you could make a mockup of what you’re looking for, that would be great.

Do you want a ScrollViewer in 3D?

I would like to make a sample.

To give a rough explanation first, I’m trying to display ScrollViewer in space, start WebXR, and follow ScrollViewer with Follow Behavior.
However, it seems that the position of ScrollViewer does not work when ScrollViewer is fixed in the center of the screen and Follow Behavior is used.
I would like to follow ScrollViewer right justified. Is there a solution?

When you follow an object with Follow Behavior, the 2D control may not work and you may not be able to position it freely.
It seems that you can arrange it freely if it is a 3D control.

Also, the question linked below will have similar final results.

If you can move like Scroll Viewer in StackPanel3D, I think that you can arrange it freely using Follow Behavior.

I see (i’m starting to see). Still not sure exactly if the panel/scrollviewer always remains attached to the right of the window or if it has to somehow angle itself towards the camera? I think the mock-up would help with this understanding of ‘how it should look n feel’.
Sadly I have no xp with xr/vr. I wanted to start with it a while ago but never got a chance so far
So, I guess I’ll have to call back @DarraghBurke on your case, see if he knows more about it.
What I do know however is:

  1. the 2d scrollviewer (2D GUI) is not intended to work with VR/XR.
  2. I have some experience with the 3D GUI, twisting controls and I know you can create your custom controls for the 3d gui, however, the slider control is not an easy control to create all custom. I wonder if anyone has done it before? So far nobody replied and I haven’t seen one.
  3. I believe if I was stuck with this, I would probably start with the option of creating a mesh slider bar and use this mesh to pilot the stackpanel (or better said an oversized panel inside a stackpanel). I believe creating the control from a mesh would be easier than create the control/component for the 3D gui… As I said, I’m not an expert here, so I hope someone will bounce on this and point you in the right direction…

As @mawa says, you can create a mesh, position it where you want it, and then use 2D GUI with AdvancedDynamicTexture.CreateForMesh(). This way you can use the existing ScrollViewer, but you’ll have to use exclusively 2D GUI controls.

If you want to go the 3D route, you can make your own ScrollViewer3D class. However, this might be pretty difficult. Slider3D already exists, but you might have a hard time clipping the regions that should not be visible.

Maybe @RaananW will have a suggestion as he has more knowledge of WebXR and 3D controls

thank you for your reply.

We have created the following playground.

[Normal mode]
I am tracking the panel with the activeCamera of the scene.

[WebXR mode]
We are following the panel using FollowBehavior.

Scroll Viewer Example Adjustable Text | Babylon.js Playground (

Around the 91st line, the position is changed when WebXR is started, but it does not seem to be changed.
Do you know the cause of this?
Also. How can I move the position?

If you track the panel with activeCamera without using FollowBehavior at WebXR, you can move the position, but in that case the panel moves too much and it is difficult to handle, so I want to move the position using FollowBehavior.

thank you for your reply.
Do you know anything from the comments above?
We apologize for the inconvenience, and thank you for your cooperation.

Sorry, as I said, I’m afraid I’m not qualified for testing VR/XR. I also don’t have the devices to test the real thing. Hopefully @DarraghBurke can help you further with this or call in someone who knows more…

@RaananW when you get a chance, could you take a look at this?

Hello @tm1128 checking in, are you still having issues with XR?