Search Unity

Cannot modify position.z if x and y are animated?

Discussion in 'Editor & General Support' started by lakehaze, Feb 17, 2012.

  1. lakehaze

    lakehaze

    Joined:
    Mar 7, 2011
    Posts:
    24
    We are using code to adjust the z depth of several objects in a prefab. Some objects will respond, but if they have animation present on their x and y position values (and z-rotation), then they ignore the instruction. It behaves as if there is a key on the z position; we can change the value in the editor, but at runtime, it resets to the original value.
    I have triple-checked: there is no animation on the z-translate in Maya. The channel is black and free to Maya modification.

    Are we breaking some clear rule here? Is there a switch or work around that will allow us access to the z position, even if x and y are occupied?

    We tried storing the z value in a variable just in case (C# seems to require that), but we are using java scripts, so no luck.


    Thanks
     
    Last edited: Feb 17, 2012
  2. nbalexis1

    nbalexis1

    Joined:
    Jul 21, 2011
    Posts:
    89
    I don't understand your problem, but I met something similar that might be helpful.
    I tried to change the position of an object with animation, but it doesn't work, so I disable the renderer of it, and create another object with no animation, and set the position and rotation according to the one with animation every tick, and then do the change.
    Hope that will be helpful for you.
     
  3. lakehaze

    lakehaze

    Joined:
    Mar 7, 2011
    Posts:
    24
    We can't modify one non-animated translate axis value if another translate axis has animation on it.

    I think I understand your solution, but it sounds more complex than our current workaround. I'm creating a non-animated parent joint to adjust the z-position of each animated joint. It just seems like a very complex solution to a fairly simple problem. It's increasing our art workload and using more resources to monitor all the new joints.

    Thanks for the reply, it may prove to be our only solution.

    I was hoping somebody might know why Unity does this, and/or how to fix it so we don't need a workaround.