Search Unity

Mecanim and gravityWeight

Discussion in 'Scripting' started by Bravo_cr, Dec 12, 2012.

  1. Bravo_cr

    Bravo_cr

    Joined:
    Jul 19, 2012
    Posts:
    148
    Hi there,

    I have been playing around with mecanim and I have to say that it's really amazing.
    In the tutorial there's a step were a gravityWeight curve is add to the animation but there isn't any other reference in the script to that curve value. So I thought it would work "in the background" modifying the gravityWeigh. The problem is that it doesn't do anything. You neither can't change the gravityWeight in the script because it is "read only". I have to change this value and don't know how.

    Are you facing the same issue?
     
  2. InsiderGamingStudio

    InsiderGamingStudio

    Joined:
    Jan 13, 2013
    Posts:
    2
    I don't know why this is happening. I have tried time and time again to get this to work but it does not. If anyone has gotten it to work, please inform me because i really need to know how to get this to work.
     
  3. Adamcbrz

    Adamcbrz

    Joined:
    Jul 13, 2011
    Posts:
    21
    Well it does work in the background but they change the variable name. It is now "GravityWeight" in the curves.
     
  4. Brad-Newman

    Brad-Newman

    Joined:
    Feb 7, 2013
    Posts:
    185
    Noticed the same thing. It's an Animator variable: http://docs.unity3d.com/Documentation/ScriptReference/Animator-gravityWeight.html I believe it disables gravity and then Animator.MatchTarget moves the character on Y instead of gravity.
    Some odd things I noticed are that the jump collider triggers play the jump/fall/roll based on time and not based on whether you've hit the ground and the jump input uses Animator.MatchTarget to interpolate the vertical position in an unrealistic manner (e.g. rapid falls from large heights). Overall, seems like a better way would be to use ray casting and the velocity of the character to calculate when they will hit the ground and play the animations for jump, fall and roll accordingly and let the gravity simulation handle moving the character on Y. But maybe I'm missing something...just started to really dig into it in earnest.
     
    Last edited: May 14, 2013
  5. pietwelve2

    pietwelve2

    Joined:
    Sep 15, 2012
    Posts:
    13
    Hi,
    I've got the same issue here, "gravityWeight" AnimationCurve does not seem to work. I badly nead it to work for climbing Ladder.
    I have tried naming it "GravityWeight" and "gravityWeight" but same result. If anyone has any clue please tell me :)
    (Please excuse my English)