Search Unity

Root position or rotation are controlled by curves - Rigidbody2D and Animator problem

Discussion in 'Animation' started by simondew, May 15, 2015.

  1. simondew

    simondew

    Joined:
    Mar 4, 2015
    Posts:
    4
    Hi

    I have a 2D character that moves, jumps and climbs using my player scripts and Rigidbody2D. There is an Animator component which controls the sprite animation and nothing else.

    I am adding a ledge grab and pull up feature but have run into a problem making my character pull themselves up the ledge.

    What I wanted to do is create a simple transform position animation of the character object moving up and across so that it would now be on top of the ledge (then I'd play the appropriate sprite anim to match). So I add a new anim clip which moves the character up and sideways slightly, but when I do this the animator warns me that "Root position or rotation are controlled by curves". This is true of this single animation, but it only get's played at a certain time.

    If I try playing the game with this warning, my character just falls through the world. If I enable 'Apply Root Motion' then the animation will function correctly but I can't move my character as it's now relying on animations to provide movement instead of the rigibody2D.

    I've tried changing the Interpolate modes on the Rigibody and the Update Mode on the Animator but none of them give me what I'm looking for.

    Is there a way round this issue?

    Thanks
    Simon
     
  2. U-GeeN

    U-GeeN

    Joined:
    Mar 22, 2015
    Posts:
    95
    Hey mate,
    I have some problem like you do, well kinda.
    And first of all go review the "root motion" section, cause its very tricky.
    I gues you didnt "generate Root Motion Curves" in the animation in hierarchy.
    So your curves dont hold your rigidbody up and its falling...
     
  3. simondew

    simondew

    Joined:
    Mar 4, 2015
    Posts:
    4
    Hi U-GeeN

    The animation I made was in the Unity animation editor - just simple keyframes. The only option on this animation clip is to toggle 'Remove Root Motion Curves' / 'Generate Root Motion Curves' Neither seem to make any difference.

    After having a fiddle, I've found I can add a keyframe to my walk animation (this stops the character falling through the ground), turn on 'Apply Root Animation' in the Animator then I can move my character in game.
    But the climb ledge animation won't play properly - it'll add sidewards motion but not vertical motion (maybe it's fighting against the physics). I can get it to play the correct animation by making the Rigidbody Kinematic but this doesn't feel like the right solution.

    All I want to do is move my character via a transform animation as I would by dragging the character in the viewport while the game is running.

    If disabling the 'Is Kinematic' is the right solution, then I can go with that but want to make sure I'm doing it correctly.

    Thanks
    Simon
     
  4. Megustagame

    Megustagame

    Joined:
    Aug 13, 2014
    Posts:
    2
    Hi, I had similar problem.
    My case was one of my sprite stuck and it is not moved by dragging.
    And animator said just like you.
    Root position or rotation are controlled by curves


    I checked the apply root motion on animator inspector.
    It worked.
    Hope this help you. : )

    thanks,
    tamaii
     
    vladutstefan27 likes this.
  5. redradist

    redradist

    Joined:
    Apr 23, 2016
    Posts:
    7
    Hello guys !

    I have a same problem. When I apply root motion, physics starts working, but the charecter starts falling down too slow.
    I mean a gravity for this object are very powerless. Without this flag gravity is strong, collider of my object does not work.

    Have somebody the same problem ?
     
    loyalvita1 likes this.
  6. DevilZ1976

    DevilZ1976

    Joined:
    Apr 19, 2016
    Posts:
    2
    Hi,
    If you still have problem try to change gravity in Edit -> Project Settings or in player rigidbody.


    Best of luck,
    L
     
    Last edited: Jul 20, 2016
  7. Dwaari

    Dwaari

    Joined:
    Jan 24, 2020
    Posts:
    1
    Hi !
    I just had the same case. I did a ledge climb animation, where i need to move the character at the end of the animation.
    I finally made my ledge animation working in a scene, and then my characters couldn't move in the others scene.
    The only difference was the "Root position or rotation are controlled by curves" in the animator.
    It means that you probably have an animation with a property where you move the position of your character.
    This is what i first tried to do, for my ledge climb animation i was moving the transform position with the property in my animation.

    To fix the bug i removed the property in the animation, and i apply the new position in my character controller.
    It worked for me, i hope it will for you too.

    Best regards,
     
  8. jbrother_unity

    jbrother_unity

    Joined:
    Feb 6, 2022
    Posts:
    2
    What helped me was setting the "apply root motion" option in my script. I set my animator's apply root motion property in my start method. Seems to work okay.
     
  9. jeyalakshmi_chandrasekaran

    jeyalakshmi_chandrasekaran

    Joined:
    Mar 8, 2021
    Posts:
    9
    This worked for me!

    I tried to apply animation to my hand controller, and once I did my controller model was not aligning with my physical controller. Apply root motion option under the animator component has solved the issue.
    Thanks :)
     
    jbrother_unity likes this.
  10. aigamecreator

    aigamecreator

    Joined:
    Jun 26, 2020
    Posts:
    3
    Thank you, it worked