SixDofDragBehavior Z position issue in VR

Hello!

I am trying to upgrade the version of the babylon js on a older project and it seems that if i try to go beyond the v6.0 the SixDofDragBehavior is not behaving as expected.

The issue i am experiencing is that, there is no movement on the Z axis for the object i am dragging with my controller.

Here is a playground with an example: https://playground.babylonjs.com/#5G9MC5#387

Steps to reproduce:

  1. Go inside vr
  2. Try to drag the goose with your controller on the Z axis (it moves only in X and Y)
  3. Change the version of babylon js to 4.2.1 and see it work on all axes X, Y and Z

Maybe there is so parameter that i don’t set to make this work, although i don’t seem to find anything related to this on the documentation (https://doc.babylonjs.com/typedoc/classes/BABYLON.SixDofDragBehavior) except the zDragFactor which only accelerates the movement on a Z direction.

Any idea on how to fix this?
Many thanks! :smile:

Relevant past thread. It does move in the Z direction just very little, we discussed adding a property to increase the amount moved relative to position of the vr camera but no solution as of yet. I have been adding a multiplier to z direction movement in my own applications.

Hello and thank you for your kind response.

I have tried your solution and it works more or less ok as long as you start with your element positioned on the X axis on 0. If the element it’s positioned and rotated somewhere else around the scene it breaks very quick. https://playground.babylonjs.com/#9K3MRA#1810 probably because dragging the element towards you does not mean you change only the Z axis but also the other 2 since you are not always facing and starting from 0,0,0 as a point of reference. I am not an an expert on this :sweat_smile:

So I suppose it’s not some param i am not aware of but some bug maybe introduced by some refactoring of this features since it was working just fine before v6.0 :smiling_face_with_tear:.

It would be really nice to have this working again.

It was working, but not entirely fine. If the dragged mesh was transformed in a certain way, the 6DoF wouldn’t work correctly. You can drag an object by grabbing it, which still works as expected. I will assign this to me and open an issue to track to get z dragging working correctly again.

2 Likes

That would be awesome, 6DoF is a great tool for manipulating objects really quick, especially in VR and AR at least from my experience.

May the force be with you in this strange endeavour! :crossed_fingers:

1 Like

Just wanted to update that this should be working now. “Pushing” or “Pulling” on the z axis works, according to your hands’/controllers’ reach. Otherwise grabbing always works :slight_smile:

1 Like

Woah, really? I test it and come back tomorrow with more feedback.

Thank you so much! :raised_hands:

1 Like

Let me know!!

Hey,

I have tried it today with babylon 7.5.0 (latest) but for me is still not working. There is still no movement on the Z axis, i can move the object in X and Y, rotate it, scale it, but cannot draw it to me or away from me.

I have used this playground: https://playground.babylonjs.com/#5G9MC5#393

Have you added some additional parameters maybe on the SixDofDragBehavior? Or it should work out of the box? :thinking:

It’s hard to notice, because, as I wrote, the z compensation is according to your hand movement. Try pulling it for a few seconds and you will see that it is slowly getting closer. This is a limitation in the implementation and I am still working on fixing the compensation on the z axis. It didn’t work at all before, but is now working 1:1 with the Z movement.

1 Like

Yes, you are right, if you keep pulling it starts to slowly move towards you. It’s a cool progress, getting close to how it was behaving before :heart_eyes:.

The compensation on the Z axis could be defined as a parameter maybe so devs can define it based on their scene size. Either way, will be really nice to have it back.

1 Like