Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Scaling the player (Lenovo Mirage)

Discussion in 'Daydream' started by eiked, Apr 19, 2019.

  1. eiked

    eiked

    Joined:
    Feb 16, 2015
    Posts:
    5
    I have a scene that has a scale of 20x20 units. But to the player, it should appear as if it was more like 1x1 sized - so something that the player can view from different angles using the 6dof head tracking.

    I know that I should be scaling the player object (I used it in another test, see here:
    ), but the GvrArmModel thingie is not cooperating very well since the last time I've used it.

    Is there a simple way to scale the player's head movement?

    I don't want to scale the world down, since this would break physics and other things.
     
  2. thep3000

    thep3000

    Unity Technologies

    Joined:
    Aug 9, 2013
    Posts:
    400
    Scaling the parent of the camera object should achieve this effect. Is that what you mean by the player object?
     
  3. eiked

    eiked

    Joined:
    Feb 16, 2015
    Posts:
    5
    Yes, it has this effect, but the problem is the arm model of the controller (GvrArmModel). It doesn't like the scaling and behaves weird. When I have the "Player" game object with controller and camera as children, scaling the "Player" is enabling me to move around with the given scale, but at larger scales, the daydream controller setup breaks somehow.

    When I did the demo in the video, I scaled the arm model values accordingly as well. But it doesn't seem to work with the latest daydream sdk anymore.
     
  4. Matt_D_work

    Matt_D_work

    Unity Technologies

    Joined:
    Nov 30, 2016
    Posts:
    202
    scaling the "player" game object (which the camera, and controllers are children of) should correctly scale the tracking information being reported by the HMD and controller in relation to the scale of the scene you're rendering.

    the arm model _should_ be operating in this tracking space, and the results of this should be correct, as long as the only place the scale is applied is at the "player" game object.

    what behavior are you seeing with the arm models?
     
  5. eiked

    eiked

    Joined:
    Feb 16, 2015
    Posts:
    5
    If I open the HelloVR scene and scale the "Player" game object which has the Main Camera and the GvrControllerPointer0, I am observing the following behaviour:
    • At a scale of 2, the controller is pretty close to the camera
    • At scale 3, it the controller starts clipping with the camera
    • At scale 4, the controller is completely behind the camera
    • At scale 10, the controller "sits in your head"
    Back then I fixed this odd behaviour by having a script that would scale the GvrArmModel properties like ElbowRestPosition, WristRestPosition, etc. accordingly, and this used to work. This doesn't work any more because the arm model's neck attachment sits even then inside the head - or, when trying to fix this, the IK model doesn't solve the pointing properly any more.

    I am now thinking to modify the GvrArmModel class to consider scaling to see what's breaking. My previous script tried to adapt the variables from outside instead.

    Thank you for your quick answers btw, I appreciate that!
     
  6. eiked

    eiked

    Joined:
    Feb 16, 2015
    Posts:
    5
    Ok, I have started to look into this more closely. The first thing I need to understand is how the scaling works in general.
    So I started the scene with a scale factor of 1 and marked all the player position, the camera position and the controller position:

    upload_2019-4-20_11-44-17.png

    You can see the gizmos of the cameras and the scene on the right how it looks when I look at the controller.
    When I scale to factor 2, it already shows that the scaling isn't working as expected:
    upload_2019-4-20_11-44-32.png

    I am scaling the markers of scale=1 as well, so in theory I would expect that the headset camera and the controller within their sphere marker centers. But it's only the case for the controller! So the arm model is actually scaling correctly! It's the camera that is moving out too much!
    At a scale of 4, it breaks completely:
    upload_2019-4-20_11-47-10.png
    The headset camera is now beyond the controller's position.
    So my theory is, that the head is scaled wrongfully twice as much. To confirm the theory, I am scaling back the camera (in another hierarchy level) by the inverse (1/4th):
    upload_2019-4-20_11-49-31.png
    ... and it seems to confirm that the camera's position is scaled twice (or something else?).

    So just that I get it right: The camera's position is attached to a virtual head. If I turn the head, the game is actually considering the head's size and the eye positions and thus the eyes/cameras are rotating around the head's center.
    So the eye position's distance to the head's center must be scaled as well - however, it appears to happen at twice the amount than actually needed. So when I scale the player object (which contains the camera) by 2, the eye-head distance is actually scaled by 4.

    For me that smells like a bug in the SDK, either Daydream or Unity itself. And either this is just an editor thing and the compiled binary is fine (which I am going to test now), or this is actually broken on a lower level.

    I'll keep you updated.
     
  7. eiked

    eiked

    Joined:
    Feb 16, 2015
    Posts:
    5
    Ok, some testing later: The actual build looks fine. Sort of. The head / eye position seems to be correct. But at higher scale factors (10 for instance), the daydream controller isn't working properly any more - I can't point into the sky: When I point up with the controller, the actual pointer isn't pointing further up than a few degrees over the horizon.

    Apart from that, I am unable to get positional head tracking running at all when trying out the build. I am stuck in a local space as if my device had no head tracking (using Lenovo Mirage).