Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Resolved Unity DOTS Animation and DOTS physics problem

Discussion in 'Physics for ECS' started by DevViktoria, Oct 26, 2021.

  1. DevViktoria

    DevViktoria

    Joined:
    Apr 6, 2021
    Posts:
    94
    Here is a video of the problem:


    In this project I am using the DOTS Animation package to animate the black thing on the bumper.
    I also use the DOTS physics engine for doing the physics calculations.
    If I animating with the enabled Physics body the black thing moves close to the origin. If I animate with disabled Physics body then the black thing is animated at it's original position.

    The black thing has an AnimationStateData which I am using to track the state of the animation.
    The animation happens in two steps.
    First I have TriggerAnimationSystem. This system modifies the AnimationStateData to indicate that the mocing animation should be played.
    Then I have a AnimationClipPlaySystem which changes the animation to the moving animation if the AnimationStateData indicates thet the moving animation should be playing.
    The TriggerAnimationSystem is annotated with [UpdateInGroup(typeof(FixedStepSimulationSystemGroup))][UpdateAfter(typeof(EndFramePhysicsSystem))].
    The AnimationClipPlaySystem is annotated with [UpdateBefore(typeof(DefaultAnimationSystemGroup))].

    I tried to change the AnimationClipPlaySystem to be annotated with [UpdateInGroup(typeof(FixedStepSimulationSystemGroup))][UpdateAfter(typeof(TriggerAnimationSystem))]. But this did not solved my problem.


    If you need any more information please let me know.
    Thank you for any ideas in advance.
     
  2. DevViktoria

    DevViktoria

    Joined:
    Apr 6, 2021
    Posts:
    94
    Hi,

    I found a solution: if I change the Physics body to be static it works, the way I wanted :)