Need help on a vertical DragObservable

I got stumped on this, I know it has to be something simple, but, I can’t get Vertical dragging to work properly - Horizontal work fine. I am using onDragObservable behavior events. I am manually updating the object position because I want to limit its movement

I have playground example here:

As I said, horizontal moves as I want it to, but, the vertical has behavioral problems.
your help is appreciated - what I need this for is I am using using 3D objects for scrollBar and scrollKnob, this is for the knob, I want to drag the knob down, and that will scroll down a page, the page logic is separate, I just need the scroll bar to work right thanks

1 Like

Maybe you could rely on the 3d Slider ?

1 Like

Otherwise I guess @Cedric might be able to help.

1 Like

Wow, I didn’t see there was a slider. It didn’t come up when i did a search, probably searched for scrollbar? Anyway, i will try out the slider - as long as i can use my own 3D objects, because I already created a somewhat fancy bar and knob

1 Like

Yup it has been added recently and I am not seeing the doc for it either @PirateJC might help on this front ?

1 Like

Yea, I didn’t find any docs either. If it will work with imported objects, i should be able to use it, but, if not, i would like to get the code i put up on playground working, because it works great with my objects in the horizontal dir, just need it to work same up and down


Found docs on the slider3d, but, don’t think there is a way for me to use my own meshes for the bar and knob (thumb) - it just allows access to the materials - so probably to change colors, so it doesn’t look like this will work for my needs -

1 Like

Yup indeed! Looks like this is missing from our docs!

Early next week, I’ll add something about the slider3D on the 3D GUI page here:

1 Like

Slider3D | Babylon.js Documentation but, like i said, doesn’t look like i can attach it to my own objects/meshes

Nope you are right.

Here is a workaround:

No idea why putting the drag axis along z is working :slight_smile: @Cedric might know but it should unlock you a bit

Actually it is because of: useObjectOrientationForDragging

You should set it in screen space:

Hey Sebavan, thanks. looks like i can make this work, but, i see it is still updating the objects Y pos, oh, yeah, i set it to use the object’s space because I was wanting to make sure it would still function even when the camera was seeing it at angles, but, i will test this out further… thanks this will help