Search Unity

problem with scaling camera in VR and throwing objects (NEED UNITY DEVS TO ANSWER)

Discussion in 'AR/VR (XR) Discussion' started by prodigal_prodigy21, Mar 11, 2019.

  1. prodigal_prodigy21

    prodigal_prodigy21

    Joined:
    Jan 9, 2017
    Posts:
    25
    ok so i wanted to set up my camera to be 10 times as big because i didnt like working in the decimal point scale in unity but then i found a serious problem

    when you scale up the camera in VR and you have your hands in VR showing up and everything looks good well physics get messed up

    i ran a test with large objects(1cm maya /1m unity) and smaller objects(1mm maya/.1m unity) and they work well with physics at their normal scale but the camera getting scaled up i think messes with the physics

    can someone else try this let me know if theres a way to fix the physics at a larger scale i set the camera to 10 times the original size and i cant throw things without them having almost no momentum when they're thrown they just fall straight down
     
  2. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,983
    That sounds like a really bad idea. You will have to work with decimal point scales in unity as it uses floats under the hood, and to be honest avoiding them because "i didnt like working in decimal point scale" is a bit nonsensical and ofcourse will make you run into issues.

    On you actual question, I have no idea how to stop this happening but certainly you shouldnt be scaling up the camera like that
     
  3. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    I agree with @GameDevCouple_I. You're just making life harder for yourself. Most likely the apparent lack of momentum is just because you forgot to increase the force/velocity you're applying to the thrown objects by 10X as well (or you overcompensated when adjusting the physics gravity, or something like that). But still, you're just causing yourself grief, especially in VR, where the assumption that 1 unit == 1 meter runs very deeply through everything, including the stereo rendering. If you change the scale, then things are not going to look right, quite apart from physics.
     
    MadeFromPolygons likes this.
  4. prodigal_prodigy21

    prodigal_prodigy21

    Joined:
    Jan 9, 2017
    Posts:
    25
    well im just using the basic oculus integration stuff from the assets store so its probably a problem with the oculus code not the unity code (i havent even added my own scripts yet i was just testing out the physics)

    the camera works fine at a larger scale like everything shows up fine. Its gotta be something with the way the VR hands scale up then translate the momentum to an object thats being released from the hand.

    @JoeStrout i'm going to run a test and create a simple grab script from scratch to see if it still does the same thing
    i have to do this anyway since i need to create custom scripts for certain actions and animations, if you can give me any advice on how to go about translating the velocity of a players hand to an object that would be great

    @GameDevCouple_I its not the decimal points that i have a problem with its the small scale overall because i have alot of objects on scene and things are ending up in .000465345 or some crazy number and i have to go in and clean things up. I also ran into problems with the UI and images on a tiny canvas so i figured i would be better off at least trying to see if its possible to scale the camera and VR hands up 10x or even just a few times bigger just to avoid UI problems or object placement problems. I'm basically porting over a game that i had at a larger scale and coding things was alot easier because everything was at 1m so one object was at x1 y1 z1 instead of what i got going now with x 0.0000234 y0.00023445 z0.045234 or whatever long decimals i have ... i'm just looking for a way to make this easier but if someone shows up and says sorry man its impossible then i'll just deal with what i got
     
  5. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    1 unit = 1 m is the standard scale. I think you are barking up the wrong tree. World canvases should be scaled down — I typically use a scale of 0.001 or 0.002 — but everything else should be at a scale of 1, assuming your models are following the standard scale. (Some models use 1 unit = 1 inch, and so you obviously have to adjust those in the import settings.)

    If you're getting weird scales like you quoted above, you should back up and figure out why. Don't just scale everything up; scale everything correctly, from the point of import. Or find the container object that has somehow gotten a weird scale on it, forcing you to scale everything inside it by the inverse amount.
     
    MadeFromPolygons likes this.
  6. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,983
    This, if you have a ton of weird scales, scaling up the camera is not the answer. In fact, scaling anything is not the answer, as you likely have a deeper problem such as incorrect original scales in the DCC program that authored the asset etc.

    But as @JoeStrout already said, 1 unit = 1m is the normal scale. Therefore if you have an object smaller than 1x1m you will end up with a scale in the decimal values. Thats very normal. Float values can go that low.

    UI will function fine on tiny scales, you just need to make sure your resolution is correct in terms of setting up canvas height + width, anchoring etc.
     
  7. prodigal_prodigy21

    prodigal_prodigy21

    Joined:
    Jan 9, 2017
    Posts:
    25
    yea i figured i should bite the bullet and just work with it like this ... like you guys mentioned without scaling up and leaving it as is
     
    MadeFromPolygons likes this.