Search Unity

Question Damped Transform accumulates over time and goes crazy

Discussion in 'Animation Rigging' started by mechanicarts, Jul 24, 2022.

  1. mechanicarts

    mechanicarts

    Joined:
    Jul 27, 2012
    Posts:
    21
    I have a rigged fish, with Damped Transform constraints and a script that controls random movement with DOTween and a "swim" tween.
    The error only occurs when the Damped Transforms are active. After a while, the fish just starts going nuts, starting with the last bone. And the error only grows exponentially, propagating to bones above over time.

    Is it possible to "clear" the accumulation in the script?

    Since it doesn't seem to be a script issue, I don't wanna clog the post with it. You can find it here - https://pastebin.com/zhaJ1XMf

     
  2. daniel_lochner

    daniel_lochner

    Joined:
    Jun 9, 2016
    Posts:
    175
    Hi there. Any luck? This is a serious issue...
     
  3. mechanicarts

    mechanicarts

    Joined:
    Jul 27, 2012
    Posts:
    21
    None. The official response from the team in another thread was "AR toolkit was built to be extensible, so you can write your own corrections".
     
  4. daniel_lochner

    daniel_lochner

    Joined:
    Jun 9, 2016
    Posts:
    175
    That's incredibly disappointing. Please could you update this thread if you come to any solution!
     
  5. mechanicarts

    mechanicarts

    Joined:
    Jul 27, 2012
    Posts:
    21
    I gave up for now. I am really a beginner in coding so I don't know how to write my own damping. But I will update if I get to any solution...
     
    daniel_lochner likes this.
  6. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    Hi,

    Trying to understand the problem here.
    Is your hierarchy ever coming back to its original configuration?
    Is this something you can reproduce without your custom script?
    Are you seeing any errors in the console?

    We have this bug in progress that could be related to yours:
    https://issuetracker.unity3d.com/issues/assertion-failed-errors-appear-when-using-dampedtransform

    Let me expand on that. Animation Rigging is a toolkit to build constraints. The constraints we have provided are a core set of constraints we believe can be useful for common use cases. So, whenever we see people having issues with the constraints, it can be either two things:
    - It's a legitimate bug. In which case, please log a bug using the Unity bug reporter to let us know. This way, it's logged in our database and we have clear reproducible steps we can use to fix the problem.
    - It's a limitation/misuse of the constraint. Perhaps the constraint doesn't work like you'd want it to work and this is why you should be able to build your own if you'd like.

    Still, when you think a constraint does not work like it should, logging a bug is the best way to give us feedback.
     
  7. mechanicarts

    mechanicarts

    Joined:
    Jul 27, 2012
    Posts:
    21
    I followed this method.
    I have a rig setup for a fish. Each bone in the spine (not the fins or the mouth, so just a straight line of bones) has a damped transform constraint to the previous bone, 0.0 for position and 0.2 for rotation, and maintain aim on (but I've also tried off).

    While a manual rotation during Play works fine, if I use forced motion from a script (for example with rigidbody addforce, MoveTo tween or translate), with every iteration, the rig starts to deform, starting with the last bone and eventually propagating up the hierarchy. I let it run for 1 hour, and the last 6 bones were affected with exponentially lower intensity. There is a wait period between the motions, so there should be plenty of time for the bones to catch up.

    The rig never smooths out, it only becomes worse over time.

    There are no errors in the console, which leads me to think the linked bug is unrelated.

    I have tried disabling and reenabling the rig component, destroying the tween, storing the initial positions/rotations for the bones and reassigning them after each cycle, but nothing worked.

    The simplest reproducible way for this is to have a script rotate the first bone in the hierarchy back and forth (with a Tween, Slerp or any other method) and giving the rest a Damped Transform, rotation only. Eventually the rig will go nuts.

    I understand the rationale behind this. No solution works out of the box for everyone using it, but this does look like a bug.
     
  8. CampbellSFletcher

    CampbellSFletcher

    Joined:
    Jul 30, 2021
    Posts:
    3
    I can confirm we have the same issue on our project, when using a long enough chain of damped transforms. Every part of the issue is the same as Mechanicarts describes.
    this doesn't seem like a wild misuse of DampedTransform, this is what it's intended for, I would bet that the big robot worm in the Unity tutorial example could be coerced into behaving the same way if left Wiggling for long enough.

    not a big deal if we only have to reset it every 10 min or so- but like Mechanicarts says, we couldn't find any way to do so. toggling it off and on doesn't fix.
     
  9. SoWellMade

    SoWellMade

    Joined:
    Feb 2, 2024
    Posts:
    1
    Well I had the same problem and fixed it by adding one more set of bones that extend past the last fin into empty space in blender. When imported it back into unity no tail malformation even with lots of action fast action. hope this helps