Direction of movement for WALKING_LOCOMOTION

I’m experimenting with webXR.

I’ve tried using WALKING_LOCOMOTION but sometimes the direction of travel isn’t what I want.
(It goes backwards instead of forwards.)

The XR environment in development is simulated using Chrome’s webXR extension.
Please see the image.

(The same result is obtained even when QuestHMD is actually used.)

The playground below

A: Original playground
https://playground.babylonjs.com/#HE33TR#11

B: Just change the initial camera position of A from (0, 5, -10) to (0, 5, 10).
https://playground.babylonjs.com/#D6QY7C
( Line 5-6 )

Simulating the same using the mouse
A: Then I will move forward as I thought.
B: Then, if you operate it in the same way, it will backwards.

Please let me know if there is a good way to move forward regardless of the camera position (to move in the direction the camera is pointing).

Sorry, just for me to be sure I understood correctly - you are saying that because the camera’s position is different you suddenly start moving backwards instead of forward?

Thank you for your quick response.
Sorry for the insufficient explanation.

I will post two images for your understanding.
Both are three captures of the screen when the following operations are performed.

  1. Open a playground
  2. Click enter XR UI button to enter XR.
  3. Simulate walking as described in the first post.
    (using Chrome’s webXR extension)

A: initial camera position (0, 5, -10)
Get closer to the sphere (forward)

B: initial camera position (0, 5, 10)
Farther away from the sphere (backward)

I would like to know how to achieve the same result as A: (Get closer to the sphere)
with an initial camera position of (0, 5, 10).

Thank you.

PS
You fixed the slider3D issue and my application no longer hangs.
Thank you very much. :heart_eyes:

1 Like

Furthermore, I tried whether it changes when the direction of the camera is different, not just the position of the camera.
Red and yellow spheres have been added to make it easier to understand.

C: initial camera position (0, 5, -10)
camera Target (0, 0, -20);
https://playground.babylonjs.com/#D6QY7C**#1**

D: initial camera position (0, 5, 10)
camera Target (0, 0, 20);
https://playground.babylonjs.com/#D6QY7C**#2**

The diagram below shows how they moved, including A: and B:.
The triangle indicates the direction of the camera, and the green arrow indicates the direction of movement.

All of these examples seem to move in the positive Z direction.

I hope it helps

Ok! I debugged it a little. The feature is basing the forward position based on the base reference space, which is the initial reference space in which the xr session has started, before the new position (and the direction) was applied. This is why it works well with one transformation, but not with the other.

I could switch to the camera’s reference space, but then there are a few issues with scaling the vectors. For some reason (that I am still struggling with), when changing the reference space only the left step is working. movement scale is incorrect as well, but that’s solvable with scaling the forward vector.

The person who developed the feature is no longer working actively on the framework, so I will need to dive into the code to fully understand what’s going on. If you don’t mind creating an issue on our github, I will assign it to me and will take it from there.

Thank you for your prompt action.

Sorry I have no experience with Github. :scream:

So I can’t create an issue myself, but I would welcome and appreciate it if you could create and respond to an issue on this subject. :smile: :laughing:

1 Like