Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Overwrite / change Unity builtin function?

Discussion in 'Scripting' started by LaurynasLubys, Nov 18, 2017.

  1. LaurynasLubys

    LaurynasLubys

    Joined:
    Mar 7, 2012
    Posts:
    80
    Hey,
    I'm working with Animator.SetLookAtWeight and Animator.SetLookAtPosition.
    I would like to access them and change / overwrite or copy and modify according my needs. Is it possible, how? I never did this before.

    The problem is that SetLookAtWeight grabs all the bones in the hierarchy and rotates them. Coming from animator's perspective that is illogical - chest in human will never rotate - spine will, head will never rotate - but neck will. How this function is build now, ruins the skinning of the model as it rotates the bones that should not rotate.

    Thank you.
     
  2. TheHighGround

    TheHighGround

    Joined:
    Nov 19, 2017
    Posts:
    68
    This video is pretty great. I think it covers what you are asking for.

    IK Animation
     
  3. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,294
    To be able to directly change builtin functions, you'd have to change the source. Getting access to the source code is possible, but the price is not listed, so it's probably not exactly cheap.


    The best thing would probably be to just implement the IK yourself, by rotating bones manually. There's also some third party IK packages out there you could use instead.