wrld3d / unity-api

Issue tracking for the WRLD Unity SDK
28 stars 8 forks source link

Camera errors when its parent is not positioned at the origin (Steam VR plugin) #6

Closed GabrielBakker closed 7 years ago

GabrielBakker commented 7 years ago

I made a simple project using Wrld with the SteamVR plugin. I added an empty GameObject and added the WRLD component to it, and plugged in my API key. Then I set SteamVR's VRCamera as the Camera for the WRLD component. I click play, and it sorta works .. The map renders and I'm able to move around the map just as expected. Only problem is, the map never streams anything more beyond the initial area. As I move around the map I quickly reach the edges of it and it just stops.

When I checked the Unity Console I see the following error (repeated thousands of times): "Expected a camera with zero translation (position should be represented in cameraOriginECEF)."

What does it mean by "zero translation"? How can I get the WRLD map to stream when using it with the SteamVR camera?

GabrielBakker commented 7 years ago

Update: I tried creating a new empty game object and giving that a disabled camera and using that for the WRLD camera and putting it as the child of the VR Camera, so that it follows its movement. That didn't work either, because my new camera had the same problem as the VR camera.

So next I temporarily got it working, by making an Unparented Game Object, putting a disabled camera on it, and a script that in its Update() method moves it automatically to put it at the same position and direction as the VR Camera.

IS that the only way to make WRLD work with the SteamVR plugin or is there a better way?

mistodon commented 7 years ago

Hi there,

It seems that there is a bug in our camera code that causes this error when the Camera has a parent GameObject which is not positioned at (0, 0, 0). I haven't used the SteamVR plugin before, but am I correct that the VR Camera object has a parent that is not at the origin?

If so, I'm afraid your current solution is what I'd recommend. We'll try to resolve the issue in a future release, but until then, what you suggest is a good workaround.

Thanks for bringing the issue to our attention. I'm going to rename this issue since I don't believe the defect is specific to the SteamVR Plugin.

GabrielBakker commented 7 years ago

Thank you.

However, I would still say that it will help other people a lot more if you keep the word Steam VR in the title.

A big part of my confusion is that nobody understands what it means when you say "Camera is not positioned at the origin", and the Steam VR API is not that well documented either so there's no way to really investigate their camera and determine whats going on -- their camera is positioned at the origin in Design mode, and it must just move around some how once the game is running.

But on your website you claim to support VR, though there is very little information about it.

One of the things that made this so challenging is that it took me a long time to figure out what the problem was. Anyone else who is having the same problem is going to be searching for "Steam VR Plugin" so the other title will help people to find the answer more quickly.

The key piece of information that was missing from all our discussions is this: "The Steam VR Camera is a Camera which is not positioned at the origin and is therefore not compatible with the WRLD API. In order to work around this issue you need to make a "fake" camera and use code to set its position to be equivalent to the position of the Steam VR Camera and then use that for the WRLD API."

See the problem is, the Steam VR Plugin isn't very clear or well documented and neither is the WRLD API so there is no way for me to determine where the Steam Camera is positioned. Honestly, I still don't even understand what it means to say the camera is not positioned at the origin -- but it probably has something to do with the motion tracking used by both Steam and Oculus -- maybe rather then move the whole camera object they move only the camera portion of the object through code somehow.

Did you guys test your API on any VR setups? Was it just the google cardboard and Gear cellphone VR setups or did you try it with any of the more complete VR systems too?

If your goal is to make the questions look better, like for advertising purposes, then I agree, you should change the title of the thread. But if your goal is to help people to be successful when they use your product, then you should keep the word Steam VR somewhere prominent so that people who are trying to figure this out in the future can find out how to make it work.

Anyway thank you for your help. As noted I got this one working. I only have 2 outstanding issues with the API and I should document those in their own thread.

Gabriel

On Thu, Jul 20, 2017 at 12:24 PM, Paul notifications@github.com wrote:

Hi there,

It seems that there is a bug in our camera code that causes this error when the Camera has a parent GameObject which is not positioned at (0, 0, 0). I haven't used the SteamVR plugin before, but am I correct that the VR Camera object has a parent that is not at the origin?

If so, I'm afraid your current solution is what I'd recommend. We'll try to resolve the issue in a future release, but until then, what you suggest is a good workaround.

Thanks for bringing the issue to our attention. I'm going to rename this issue since I don't believe the defect is specific to the SteamVR Plugin.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/wrld3d/unity-api/issues/6#issuecomment-316756578, or mute the thread https://github.com/notifications/unsubscribe-auth/Aco2B0BOGMML-T2LWPzUStNrp5urlK9Wks5sP39NgaJpZM4OSMgy .

GabrielBakker commented 7 years ago

Additionally, one of the more confusing things about the way you are stating your answer (i'm only providing this feedback to help you as you provide support for others, since I got this working by now) is that when you say it errors when there is a camera that is not positioned at the origin, what does that mean?

You see, the origin of the game world, (position 0,0,0) would be a single point in the game world -- of course the camera moves around from that point! Otherwise what would be the point of even using a camera!!!

So I'm guessing that you mean there is something strange about the way the Camera Component relates to the Game Object that it sits on. And that makes sense given the context of the Steam VR plugin and VR that includes motion tracking, but there's no way to make a camera like that on your own.

Thats why its so confusing -- the error really means "WRLD API does not work with FUNNY CAMERAS, of which the Steam VR camera is one." Because "Zero Translation" or "At the Origin Point" each describe something else..

Gabriel

mistodon commented 7 years ago

The "Camera is not positioned at the origin" message is an internal assertion - the fact that you're even seeing it is part of this bug. Your actual Camera of course does not have to be positioned at the origin (though if it has a parent GameObject, that GameObject does, due to this bug).

You do have a point though that other users of the Steam VR plugin may run into this issue, so I'll put that back into the title of this issue.

Thanks again for the feedback and we'll take a look at your other issues soon.

GabrielBakker commented 7 years ago

Thank you

On Jul 24, 2017 8:41 AM, "Paul" notifications@github.com wrote:

The "Camera is not positioned at the origin" message is an internal assertion - the fact that you're even seeing it is part of this bug. Your actual Camera of course does not have to be positioned at the origin (though if it has a parent GameObject, that GameObject does, due to this bug).

You do have a point though that other users of the Steam VR plugin may run into this issue, so I'll put that back into the title of this issue.

Thanks again for the feedback and we'll take a look at your other issues soon.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/wrld3d/unity-api/issues/6#issuecomment-317410242, or mute the thread https://github.com/notifications/unsubscribe-auth/Aco2B_re26KlP6yS5Zh3GzYRl6bzGJ7Eks5sRJDfgaJpZM4OSMgy .

nanie commented 7 years ago

Having the same problem. Tryed the workaround @GabrielBakker described but it didn't work :(

malcolm-brown commented 7 years ago

This should've been resolved in V0.5 of the SDK