Search Unity

Transform issues in WebGL Builds only with Unity 2017

Discussion in 'Web' started by andrew210, Jul 18, 2017.

  1. andrew210

    andrew210

    Joined:
    Apr 23, 2014
    Posts:
    241


    As the title suggests, after updating to Unity 2017 I created a WebGL build and there appears to be some serious issues with gameobjects and their transforms. The issue is only present in WebGL builds (iOS, Android, Facebook Gameroom all the horses face in the direction they run in). Is this a bug people are aware of? Will I have to add additional code to catch and correct this in WebGL?
     
  2. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    This is not a known issue. Could you please reproduce with a minimal project and submit a bug report?
     
  3. andrew210

    andrew210

    Joined:
    Apr 23, 2014
    Posts:
    241
    Just reverted to Unity 5.6.2 for now, am a little overworked at the moment but will try to create a minimal project to submit this soon (my gut feeling is that these horses are all follow splines and there'll be some sort of floating point precision issue present on WebGL thats not there on other platforms, but then I am making wild guesses with that)
     
  4. andrew210

    andrew210

    Joined:
    Apr 23, 2014
    Posts:
    241
    Ok have been working on this for a while now, part 1 is just the test of the LookRotation function and the spline following function, the cube points longwise forwards as expected and travels around the spline as it does in editor:

    http://www.blueomega.me/WebGLLookTest/

    Code (CSharp):
    1.     public void handleRotation(Vector3 aTarget) {
    2.         Vector3 diff = aTarget-transform.position;
    3.         if (diff.magnitude > 0f) {
    4.             Quaternion targetRot = Quaternion.LookRotation (aTarget - transform.position);
    5.  
    6.             this.transform.rotation = Quaternion.Slerp (transform.rotation, targetRot, 0.1f);
    7.         }
    8.     }
    After this I tried swapping out the cube for a horse, in editor it works perfectly again (as it does on all other platforms).

    However WebGL looks like this (the horse is -90 degrees on the y axis "wrong")

    http://www.blueomega.me/WebGLLookTest3/


    Note that if I remove the animator component from the horse it goes back to looking "right":

    http://www.blueomega.me/WebGLLookTest4/


    I have submitted a bug report for this now but never seem to receive any sort of e-mail confirmation that a bug has been reported.
     
  5. Mikael-H

    Mikael-H

    Joined:
    Apr 26, 2013
    Posts:
    309
    Do you have a ticket for your bug? I just upgraded to 2017 and am getting s similar error on web gl only. Also, only in build, not in editor.
     
  6. Mikael-H

    Mikael-H

    Joined:
    Apr 26, 2013
    Posts:
    309
    To add to this, just downloaded an asset from asset store, added an animator to one of the characters and built for webgl. In the build the character with an animator is slightly turned to the side, running in editor he is properly facing forward.

    See attached image for side by side comparison, camera angles are exactly the same.

    2017-08-26.png
     
  7. Mikael-H

    Mikael-H

    Joined:
    Apr 26, 2013
    Posts:
    309
    Bug reported with repro case, bug report here:
    https://fogbugz.unity3d.com/default.asp?945641_nqibk051vgddc148
    [EDIT:] Bug number 945641 [END EDIT]

    This MIGHT be the same bug as reported here:
    https://issuetracker.unity3d.com/is...s-between-editor-slash-pc-and-webgl-slash-mac
    which is marked as fixed in future release. Would be nice to know which though, patch or 2017.2 in september?

    In that bug they mention generic animation though, this is humanoid.

    @Marco-Trivellato could you shed some light on this? This is holding back my release atm so would like to know if I need to try to downgrade my project to 5.6 or not
     
    Last edited: Aug 28, 2017
  8. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    the link to the bug is private, I suggest you only post the bug number ;)
     
    Last edited: Aug 28, 2017
    Mikael-H likes this.
  9. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    from what I can see the bug has been fixed in 2017.3 (alpha), back-ported to 2017.2 and is in the process of being back-ported to 17.1
     
    Mikael-H likes this.
  10. Mikael-H

    Mikael-H

    Joined:
    Apr 26, 2013
    Posts:
    309
    Oh, thanks, didn't know :)

    I see, so if I use 2017.2 beta then this problem goes away? I can live with a beta in that case :)
     
  11. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Yes, it should. I suggest to give it a try.
     
    Mikael-H likes this.
  12. andrew210

    andrew210

    Joined:
    Apr 23, 2014
    Posts:
    241
    Did using the beta help for you at all? I just tried it on 2017.2.0b9 and it's as pretty horrific still on my side at least.



    Edit

    I tell a lie, the code that made it stay "pretty horrific" was my code that tried to correct the objects rotation to compensate for the old bug. On 2017.2.0b9 everything so far is working as expected.
     
    Last edited: Aug 30, 2017