World navigation discussion

I’m trying to make an effect where we can navigate around 3D scene that doesn’t require the user to move around in the real world. But oh my god, it has so many challenges to compensate the Spark AR limitation.

The basic principle is pretty simple. the camera stays, the world moves. Easy, right? No.
The navigation option could be using screen ui button to go forward, backward, left and right.
Or using pre defined path (Teleport) like google street view.

questions for button navigation:

  1. how to make when we see up and press forward, we still stays on the ground but moving forward tangent to the ground, and not flying?
  2. how to solve the gimbal lock so no matter how many degree of rotation we do, the up and down rotation and movement doesn’t go funky, reversed/inverted? I tried to use if else logic based on 90 degree, but it doesn’t work as good as I wanted, the interpolation of in between ranges still exist. So, is there a way or math formula to solve it?

Questions for teleport:

  1. how to seamlessly switch position where the origin of the “world” also changes? cuz using global transform only, to switch makes the world going back and forth like crazy (like feedback loop of callbacks). I tried to pass it to script and use pinlastvalue combination, it stops the loop but somehow it produces some precision issue where the position is getting some random offset which I assume it is because some latency or fps and computing power dependent or most likely I’m missing something. That makes this method become more frustrating than it should because the result is inconsistent and unpredictable.
  2. continuing from number 1, but this time is for the view rotation. because I still haven’t find a way to also change the origin of new position, the rotation gets funky. because the pivot is not changing.

Anyone has solution for this?

The only real solution to gimbal lock is to use quaternions instead of euler angles, but that’s something that needs to be implemented by spark. It’s frustrating because obviously the plane tracker transforms don’t have the same issue as the device orientation values, so it must be working at some place in their code.

I think you NEED to use the plane tracker in order to get the correct rotational values. You could offset the plane tracker children based on the user’s world position if you want to cancel out their movement in space, and only allow teleportation movement.

You can get the forward vector by taking the difference of two null object positions (one in the camera and one in the focal plane). Then you can set the y value to zero since you don’t want any vertical movement.

1 Like

Ahhh thanks for the insight Josh. I’ll try it out tomorrow!