Search Unity

Slippery Transform

Discussion in 'General Graphics' started by achrist3, Jan 13, 2018.

  1. achrist3

    achrist3

    Joined:
    Oct 16, 2013
    Posts:
    4
    Hi -

    I'm hoping someone who knows Unity better than me has a simple fix for this.

    I have a simple scene with an "infinite ground plane" - that is the UVs are edited to loop a texture forever making it look like the player is moving, but the player is actually always at the origin.

    I am trying to get some features in the environment to move with the texture and past the static player. I do this by simply adding the opposite of the UV offset to the environment transform.

    However there seems to be some kind of inertia setting that is making the environment objects sort of shake out of place. It looks like when the player starts moving or stops moving, the environment objects disconnect from the ground.

    Does anyone know what might be happening? Here's video of the problem:


    Thanks!
    AJ
     
  2. McDev02

    McDev02

    Joined:
    Nov 22, 2010
    Posts:
    664
    Maybe you should show the code to us where you apply both values for the environment and the shader for your grid. There might be an execution timing error.
     
  3. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,339
    Do the objects you're moving have rigid bodies? If they're not set to kinematic they might actually have inertia and "shake out of place" exactly like you're describing.
     
    theANMATOR2b likes this.
  4. achrist3

    achrist3

    Joined:
    Oct 16, 2013
    Posts:
    4
    So I managed to fix it by calling the translation in a "FixedUpdate()" loop instead of the standard "Update()" loop. Not totally sure why that worked, but it's perfectly synced now...
     
  5. McDev02

    McDev02

    Joined:
    Nov 22, 2010
    Posts:
    664
    That doesn't sound like the correct way and makes me assume that @bgolus was right. Maybe you have some physics going on and usually a static rock needs no physics...
    Another thing could be that you turned VSynch off in QualitySettings.
     
    Last edited: Jan 20, 2018
    theANMATOR2b likes this.