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.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

rigidbody acts weird with multiple animation-layers and root-motion

Discussion in 'Animation' started by TheSky, Jan 10, 2018.

  1. TheSky

    TheSky

    Joined:
    Feb 16, 2015
    Posts:
    46
    I have a little problem with the animation system.
    If you have an object with Rigidbody and an animator with several animation layers and you additionally activate root-motion, the object moves upwards. (even without animations in the animator)
    The upward movement is the stronger, the higher the gravity in the Rigidbody is set. (It does not matter if it's a rigidbody or rigidbody2d)
    However, this only happens if the editor is running normally. If you run the editor via the step button, the object does not move further up.

    the problem can be reproduced as follows:
    1. Make an object with Rigidbody and Animator.
    2. Create two animation layers in the animator. (It does not matter if there are animations in it)
    3. enable root motion
    4. press play.

    My problem now is that I absolutely need root-motion for one of my animations. (However, root-motion seems to be a bit buggy in general).
    In my particular project, I now wanted to make a layer for body-movements like run or jump and make another layer for attacks.
    In this way, the attack animations could be overlaid with the run or jump animations and you could, for example, attack while running.
    Is there any way to fix the problem, or does anyone know another way to overrlay the animations?
     
  2. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,383
    Honestly I did not expect this to repro, but it does (2017.2.0f3)... Pretty bizarre that I haven't run into this before.

    Good find.
     
  3. TheSky

    TheSky

    Joined:
    Feb 16, 2015
    Posts:
    46
    I sent a bug report. But even if the problem is fixed, this will probably take a while until the fix is published.
    Does anyone have a workaround for the problem, or any other idea of how I can achieve the behavior that I would like to have?
     
  4. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,383
    It seems limited to this specific scenario, I don't see it happening in my normal controllers. Try changing small things like adding animations, transitions, rb settings, mesh objects, etc, until it starts behaving correctly.
     
  5. orenwang

    orenwang

    Joined:
    Jul 7, 2023
    Posts:
    2
    Same issue here... in 2023
     
    Nebulaoblivion likes this.
  6. Nebulaoblivion

    Nebulaoblivion

    Joined:
    Dec 9, 2017
    Posts:
    8
    Ditto, but just for my generic rigs, the humanoid ones are working fine.