Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Bug Quaternion is not finite

Discussion in 'DOTS Animation' started by jaydenm, Feb 2, 2022.

  1. jaydenm

    jaydenm

    Joined:
    Nov 16, 2018
    Posts:
    11
    Hi there, I've been using the DOTS Animation package with success so far (thanks to everyone in these forums for your useful info) in Unity 2020.3, but have hit an error that also seems to popup in the Unity.Animation.Samples demo too.

    I am trying to use the TwoBoneIKNode modelling it off the Constraints demo, but get the error below. It only appears once when the entity being animated is instantiated and both the animation and IK work afterwards. But it would be great if I could work out how to make the error go away altogether.

    Has anyone seen this error and fixed it, or has any ideas what might be causing it?

    I can provide code, but you can reproduce this error reliably by just playing the Constraints demo.

    Code (CSharp):
    1. NotFiniteNumberException: AnimationStream: quaternion is not finite
    2. Unity.Animation.AnimationStream.ValidateIsFinite (Unity.Mathematics.quaternion value) (at Library/PackageCache/com.unity.animation@0.9.0-preview.6/Unity.Animation/Core/AnimationStreamValidation.cs:87)
    3. Unity.Animation.AnimationStream.SetLocalToRootRotation (System.Int32 index, Unity.Mathematics.quaternion& rotation) (at Library/PackageCache/com.unity.animation@0.9.0-preview.6/Unity.Animation/Core/AnimationStream.cs:353)
    4. Unity.Animation.Core.SolveTwoBoneIK (Unity.Animation.AnimationStream& stream, Unity.Animation.Core+TwoBoneIKData& data, System.Single weight) (at Library/PackageCache/com.unity.animation@0.9.0-preview.6/Unity.Animation/Core/Constraints.cs:100)
    5. Unity.Animation.TwoBoneIKNode+Kernel.Execute (Unity.DataFlowGraph.RenderContext ctx, Unity.Animation.TwoBoneIKNode+KernelData& data, Unity.Animation.TwoBoneIKNode+KernelDefs& ports) (at Library/PackageCache/com.unity.animation@0.9.0-preview.6/Unity.Animation.Graph/Constraints/TwoBoneIKNode.cs:136)
    6. Unity.Animation.TwoBoneIKNode+Kernel.Unity.DataFlowGraph.IGraphKernel<Unity.Animation.TwoBoneIKNode.KernelData,Unity.Animation.TwoBoneIKNode.KernelDefs>.Execute (Unity.DataFlowGraph.RenderContext ctx, Unity.Animation.TwoBoneIKNode+KernelData& data, Unity.Animation.TwoBoneIKNode+KernelDefs& ports) (at <72c999b93db442788eea13c89e501235>:0)
    7. Unity.DataFlowGraph.GraphKernel`3[TUserKernel,TKernelData,TKernelPortDefinition].Execute (Unity.DataFlowGraph.RenderContext& ctx, Unity.DataFlowGraph.KernelLayout+Pointers& instance) (at Library/PackageCache/com.unity.dataflowgraph@0.19.0-preview.7/Runtime/Kernels/RenderKernel.cs:156)
    8. Unity.DataFlowGraph.RenderKernelFunction.Invoke (Unity.DataFlowGraph.RenderContext ctx, Unity.DataFlowGraph.KernelLayout+Pointers& instance) (at Library/PackageCache/com.unity.dataflowgraph@0.19.0-preview.7/Runtime/Kernels/RenderKernel.cs:124)
    9. Unity.DataFlowGraph.RenderGraph+ParallelRenderer.Execute (System.Int32 islandIndex) (at Library/PackageCache/com.unity.dataflowgraph@0.19.0-preview.7/Runtime/RenderGraphJobs.cs:595)
    10. Unity.Jobs.IJobParallelForDeferExtensions+JobParallelForDeferProducer`1[T].Execute (T& jobData, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at Library/PackageCache/com.unity.jobs@0.8.0-preview.23/Unity.Jobs/IJobParallelForDefer.cs:62)
     
  2. StickyKevin

    StickyKevin

    Joined:
    Jul 1, 2020
    Posts:
    22
    This can happen occasionally when Burst Compilation is turned off.
    Can you check if it's turned on at your side?
     
    jaydenm likes this.
  3. jaydenm

    jaydenm

    Joined:
    Nov 16, 2018
    Posts:
    11
    Thanks @StickyKevin You are correct that Burst is turned off to get that stack trace, but the exception still occurs every time with Burst enabled unfortunately (you just lose the stack trace and get the usual message about disabling burst for traces).

    In the meantime (this might help anyone else hitting this if I don't find a proper solution) I've found you can delay adding the IK graph to the entity for 1 update cycle - this lets it get initialized correctly without throwing the error and everything is happy - weird.
     
  4. StickyKevin

    StickyKevin

    Joined:
    Jul 1, 2020
    Posts:
    22
    Ah, I get that. Generic Stracktrace messages are a pain.

    Now that I look back at when I encountered this in my own project almost a full year ago, I have applied this 'fix' as well.
    But I can't remember encountering this in the Sample project...
     
    jaydenm likes this.
  5. jaydenm

    jaydenm

    Joined:
    Nov 16, 2018
    Posts:
    11
    That's oddly comforting knowing that you've hit the error and applied the same workaround :D

    I'm guessing it's just an edge case bug caused by some state the tests don't account for, and was never fixed before the package updates got paused. Hopefully soon after 0.50 entities is release, we'll get some new updates through.
     
    StickyKevin likes this.
  6. StickyKevin

    StickyKevin

    Joined:
    Jul 1, 2020
    Posts:
    22
    That would probably be the case yeah. I am looking forward to the 0.50 version too.