Answered

How to move the model's eyes with IK?

Anonymous 2 years ago updated by 味噌千代 2 years ago 3

こんにちは!素晴らしい資産をありがとう。

すでに登場している場合はごめんなさい。IKで目を動かす方法があるか知りたいです。

モデルの目を1つずつ直接動かすことができました。

ただ、片方の骨やゲームオブジェクトを動かして両目で見られる方が楽だと思います。

ブレンダーを使えばIKでそれができましたが、UMotionでたくさん試しましたが、それは困難でした。

それを行う方法はありますか?

モデルはヒューマノイドです。

UMotion Version:
Unity Version:

Answer

Answer
Answered

Hi,
thank you very much for your support request.

There is currently no native implementation of a "Look-At" constraint in UMotion but by using the UMotion callback system you can add that functionality with just a few lines of code. I've created the script for you, please create a file named "UMotionLookConstraint.cs" in your Unity project and copy & paste the following code. Then follow the comments in the code to learn how to use the script:

using UnityEngine;

// Outside of UMotion, assign this script to both the left and right eye bone of your character.
// Create a new empty transform, name it something like "Eye Target" and assign it to the "Eye Target Transform" field in the inspector.
// Pro tip: Use one separate target per eye and one parent empty transform to move both at the same time. That allows you to animate/control eye convergence.
public class UMotionLookConstraint : MonoBehaviour
{
    public Transform EyeTargetTransform = null;

    // Open the "Options" tab in the clip editor and in the "Extending UMotion" foldout add "UMotionCallback" into the "Callback Name" input field.
    // Documentation: https://www.soxware.com/umotion-manual/Options.html#ExtendingUMotion
    public void UMotionCallback()
    {
        // Assumes that the z-axis is the forward axis of the eye.
        // Use ".right" (x-Axis) or ".up" (y-Axis) in case a different axis is the eye's forward axis.
        // Put a minus in front of the parenthesis if the axis is pointing in the opposite direction.
        transform.forward = (EyeTargetTransform.position - transform.position);
    }
}

If you have any questions how to use the script, please let me know. I'm happy to help.

Best regards,
Peter

Oops, excuse me, before translating.


Hello! Thank you for the wonderful assets.

I'm sorry if it has already appeared. I want to know if there is a way to move my eyes with IK.

I was able to move the model's eyes one by one directly.

However, I think it would be easier if there was a way for both eyes to see it by moving one bone or game object.

With blender I could do that with IK, but I tried a lot with UMotion but it was difficult.

Is there a way to do that?

The model is humanoid.

Answer
Answered

Hi,
thank you very much for your support request.

There is currently no native implementation of a "Look-At" constraint in UMotion but by using the UMotion callback system you can add that functionality with just a few lines of code. I've created the script for you, please create a file named "UMotionLookConstraint.cs" in your Unity project and copy & paste the following code. Then follow the comments in the code to learn how to use the script:

using UnityEngine;

// Outside of UMotion, assign this script to both the left and right eye bone of your character.
// Create a new empty transform, name it something like "Eye Target" and assign it to the "Eye Target Transform" field in the inspector.
// Pro tip: Use one separate target per eye and one parent empty transform to move both at the same time. That allows you to animate/control eye convergence.
public class UMotionLookConstraint : MonoBehaviour
{
    public Transform EyeTargetTransform = null;

    // Open the "Options" tab in the clip editor and in the "Extending UMotion" foldout add "UMotionCallback" into the "Callback Name" input field.
    // Documentation: https://www.soxware.com/umotion-manual/Options.html#ExtendingUMotion
    public void UMotionCallback()
    {
        // Assumes that the z-axis is the forward axis of the eye.
        // Use ".right" (x-Axis) or ".up" (y-Axis) in case a different axis is the eye's forward axis.
        // Put a minus in front of the parenthesis if the axis is pointing in the opposite direction.
        transform.forward = (EyeTargetTransform.position - transform.position);
    }
}

If you have any questions how to use the script, please let me know. I'm happy to help.

Best regards,
Peter

Thank you for your reply!

The script worked mostly well, but when I found out about the existence of the FinalIK integration and tried it, it worked better!

I was surprised that Final IK works on the editor! Thanks for the amazing animation assets and their integration.