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. Let us know your feedback about the Global Illumination changes in the 2023.2 beta.
    Dismiss Notice
  3. Dismiss Notice

OnStateIK () gets called twice. Why?

Discussion in 'Unity 5 Pre-order Beta' started by NoUJoe, Nov 23, 2014.

  1. NoUJoe

    NoUJoe

    Joined:
    Mar 7, 2014
    Posts:
    30
    Just noticed that OnStateIK for the new state machine behaviours gets called twice and it's kinda messing up my scripts. Would have presumed it would only get called once. Is there a reason for this?
     
  2. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    No, should be called only once, please log a bug with your project

    Thx
     
  3. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    659
    Really? I was under the impression it was meant to be called twice, based on our discussion in this thread:

    http://forum.unity3d.com/threads/question-about-ik-targets.274011/
    Seems to me it's always been called twice (once for the pre pass and once for the layer).

    Edit: Hold on, what's OnStateIK()? I only know of OnAnimatorIK().
     
  4. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    It not the same function.

    OnStateIK is for StateMachineBehaviour only, it only get called when this state is active. This is a 5.0 feature
    OnAnimatorIK is a monobehaviour callback and get called at each frame for each layer with IK pass ON.
     
  5. NoUJoe

    NoUJoe

    Joined:
    Mar 7, 2014
    Posts:
    30
    Alright will test to make sure it isn't anything to do with layers, I'm pretty sure I already tested it and it wasn't! I'll send a bug report.

    Also, is there anything planned in the future for some more IK? Not just arms and legs, maybe custom IK? Got a 4 armed guy on the way, would be really cool to be able to use IK on all four arms!!!
     
  6. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    yes we are working on a generic IK ans also generic retargeting.
     
    hopeful, NoUJoe and elbows like this.
  7. NoUJoe

    NoUJoe

    Joined:
    Mar 7, 2014
    Posts:
    30
    Sweeeeet!