Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera's children don't follow camera's Y position when presenting (in Oculus) #3365

Closed
meatwallace opened this issue Jan 30, 2018 · 13 comments

Comments

@meatwallace
Copy link

Description:

Simple reproduction: camera entity with a cursor/raycaster as a child entity

  • When VR isn't presenting, with or without a position.y set on the camera at all, the camera & child renders at the expected position
  • When presenting, position.y on the camera entity appears to have no effect at all on the camera itself or the child entities
  • Tested position.x and confirmed the child follows the correct Y axis

Basically, if you explicitly set the camera Y pos to 1.6 so that it matches the environment like Oculus, child entities drop to the floor when presenting. Might be the same issue reported in this comment, as if your cursor isn't far enough from the camera, it disappears from sight + your raycaster height is off.

Details:

@dmarcos
Copy link
Member

dmarcos commented Jan 30, 2018

@meatwallace Make sure you do npm install when using master because the three version pointed by the package.json has changed.

@ngokevin
Copy link
Member

@dmarcos The dist is built by the bot on each commit (whether using via the rawgit or npm), so the three.js version is up to date if they use master).

@ngokevin
Copy link
Member

Console says three Version: github:dmarcos/three.js#r89fix

@meatwallace
Copy link
Author

meatwallace commented Jan 30, 2018

@dmarcos my project is reporting github:dmarcos/three.js#r89fix and 2d651b7, and the CodeSandbox repro the same three version with 5243a56 (latest patch). Issue exists on both.

Is the likely cause of this clear / is there a particular place I should start looking? I'm happy to spend some time investigating myself, although i'm not all that familiar with A-Frame/three.js source.

edit: after reading and fiddling with WebVRManager#render and WebVRManager#getCamera code for an hour or two I have determined I have no idea what I'm doing 🆘

@ngokevin
Copy link
Member

ngokevin commented Feb 2, 2018

I think a workaround is to wrap the camera children in another entity. Does that work?

@Plarixtu
Copy link

Plarixtu commented Feb 16, 2018

I have also some difficulties with attaching enteties to my VR camera. Not sure if I'm doing something wrong or if it is a bug. It was working before with v0.7.0.

I have a sphere as a child of my VR camera (simulating the players head). As soon as I enter VR mode (Vive) the children of my camera stay at position 0 0 0, while the viewport (camera jumps to the the relative coordinates within my real room). From there I can see the Sphere follow the movements of my headset but at the position of the scene origin.

I also tried to wrap the sphere and all my head meshes within a single entity wrapper. Still the same behaviour.

@brianpeiris
Copy link
Contributor

I may have fixed this in mrdoob/three.js#13350

@brianpeiris
Copy link
Contributor

Er, I meant mrdoob/three.js#13414

@Plarixtu
Copy link

I'm not sure about the oculus y-axis issue, but if anyone is interested about the strange behaviour I was discovering on my project: I found a workaround and figured out that I can fix my problem by NOT using the "active: true" option for the camera (maybe I should open a seperate issue for this - but I'm not sure if this is a real issue - or my lack of knowlege about aframe).

In my project The player camera gets initialized later on when the info is pushed by the server. So A-Frame has already created the default camera. So I create a new camera for the player with <a-entity camera="active: true"> once I received the order by the server.

Now there are two things happening when I enter VRmode (as mentioned it's fixed when I leave out the active: true part):

  1. the y-position of the camera children (using a sphere with radius 0.3) is exactly off by the height of the sphere (0.6) - which I think should not be the case, as the origin of a sphere should be in the center.

  2. The rotation of my camera seems not to be synchronized with the initial headset ratation what makes the children move in the wrong direction. So if the headset for ex. moves forward, the children also move farward but in the direction of their own forward axis which is not the same as the headset anymore. This leads to the strange effect, that you can watch the children dancing around like a mirror of youself from a different position.

As I figured out it seems that I do not have to use the active: true option to tell A-Frame to make the new camera the active one. So I can just leave it out and it's then working correctly. Still I feel this looks like a bug to me, right?

@dmarcos
Copy link
Member

dmarcos commented Feb 24, 2018

@Plaritxu Have you tried with master?

@Plarixtu
Copy link

Yes, I think so, but I will doulbe check when I have time in a couple of days. I'll try to create a stripped down version of my code and see if I can create a simple test case that reproduces the behaviour.

@meatwallace
Copy link
Author

@dmarcos @ngokevin master appears to have resolved the issue.

@dmarcos
Copy link
Member

dmarcos commented Feb 27, 2018

@meatwallace Sweet! Thanks for veryfing.

@dmarcos dmarcos closed this as completed Feb 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants