Answered

Freely Position-able Target Point (Inside Humanoid)

gerudobombshell 4 months ago updated by Peter - Soxware Developer 4 months ago 4

Hello!

I would like to, as part of my humanoid animations, sometimes create and 'animate' the position of an invisible game object.


Description:

I am working right now on an animation, where my character jumps up, hangs for a moment, and hoists himself to his feet on a ledge about 3 meters up. I would like to have two freely movable, pinnable game objects to track through the animation where the static 'ledge' edge is, and also the current general position of the hands. However, I am having trouble accomplishing this. 


The 'Target1'/'Target2' transforms of the GameObjects will be referenced inside a C# script, which will update the player's physical location frame-by-frame as the animation unfolds.

Problem 1:

When I add two game objects, named 'Target1' and 'Target2' to my character's 'root' transform, UMotion tells me that I am not allowed to 'animate' a game object unless it has a humanoid-bone parent.

Problem 2:

I tried adding 'Target1' and 'Target2' with 'hips' as the parent. Although I can now animate the position of the game objects, there is no way for me to 'pin' the targets; they inherit the motion of the hips, and they move and rotate along with them.

Problem 3:

I tried adding multiple parents to the 'Target1' and 'Target2' points - pretending that they have 'legs'. I added thigh, knee, and calf game objects for both Targets, and set up a 'Custom IK' for both. This was the closest I have come so far to a working solution. However, there are limitations to this setup - for instance, the distance the game objects can successfully be pinned is limited by these imaginary legs. Furthermore, I'm just not really a fan of this setup.

Any advice?

Thanks!

Zach.

UMotion Version:
1.26
Unity Version:
2021.1.10f1

Answer

Answer
Answered

Hi Zach,

thank you very much for your support request.

You can assign the child-of constraint to your GameObjects. Then (in pose mode), select the GameObject and set the root GameObject as parent (in the channels view). There should be no need for creating an IK chain (like in problem 3).

All the details about the child-of constraint can be found in this video tutorial:

Another solution would be to change your character to generic as it gives you full flexibility because you can animate any GameObject in it. If you do not need the animation re-targeting of the humanoid animation system, generic is often the better choice.

Please let me know if that works for you.

Best regards,
Peter

Answer
Answered

Hi Zach,

thank you very much for your support request.

You can assign the child-of constraint to your GameObjects. Then (in pose mode), select the GameObject and set the root GameObject as parent (in the channels view). There should be no need for creating an IK chain (like in problem 3).

All the details about the child-of constraint can be found in this video tutorial:

Another solution would be to change your character to generic as it gives you full flexibility because you can animate any GameObject in it. If you do not need the animation re-targeting of the humanoid animation system, generic is often the better choice.

Please let me know if that works for you.

Best regards,
Peter

Animation Preview and Overview


Programmatically (C#), the goal to accomplishing a proper 'Climb' animation is:

  • Raycast to find the corner of the edge 
  • Begin playing animation
  • Track the position of Target1 and Target2 to interpolate between the starting position and ending position of the player.

The success of this specific technique - raycasting, interpolating, updating position - relies on the 'Target' game objects retaining perfect position and rotation.


Child Of Constraint

The child of constraint seems like it could solve the problem - however, I'm not sure I understand how to fully utilize it. Here are my difficulties:

Child Of (No pin)

(In this setup, I used the 'root' game object as the parent.)

Below are two images. The first is the Target game object, as seen from inside UMotion. The second is the same Target object in the exported animation.



Child Of (IK Pinning)

With IK-Pinning enabled, I am unfortunately still not getting the proper placement of the target game object upon export. For both targets, I have 'IK Pinning' keyed to 'true' for the entire animation.


I'm not sure if I'm correctly working with the 'ChildOf' constraint, but I am willing to admit I don't quite understand it. 


Converting To Humanoid

Based on your recommendation, I figured I'd try converting my entire rig and all of its animations into a 'generic' rig controller mode. However, I felt nervous about attempting this after a little bit of investigating, and I did not actually do this.

I began by simply googling "Convert humanoid to generic rig unity", followed the top link, and found about a tool being released with the UMotion Community Editon, named "Animation Converter", which seems to accomplish exactly what I'm after. However, the first hiccup appeared partway down the discussion:

https://forum.unity.com/threads/animation-converter-humanoid-generic-legacy.513433/  - Comment #13

   |  Just making sure -- this tool [Animation Converter] is not included with UMotion Pro, correct?

and the subsequent reply (Comment #14):

  | Correct, this tool is not included in UMotion Pro. But to some extend (though not that convenient) you can also use UMotion Pro to convert animations (see "Conversion between humanoid/generic" headline in the "Clip Editor --> Import / Export" chapter in the UMotion manual).

I wasn't really sure how to 'use UMotion Pro to convert animations' - the process seemed a little tricky to me, and I wasn't feeling confident I'd understand how to do that. So, I figured despite me having the UMotion Pro edition, maybe I could 'partially install' the Community edition, only selecting to import the 'Animation Converter' component. This unfortunately did not work, as I was unable to determine which specific components were pertinent to the Animation Converter.

Afraid that I may screw up my UMotion Pro install by clicking 'Import All', I decided that I would not continue with this endeavor.

Hello!

I seem to have changed something, and now the target is properly positioned throughout the animation! I wish I could share what the fix was, but it seems that I can't!

The correct configuration for me was using the 'ChildOf' constraint, with 'IK Pinning' checked.

Thank you for your assistance! I feel like I've learned an integral part of UMotion from your previous suggestions - and sorry for the long-winded post!

-Zach

The Animation Converter is a separate tool on the asset store. It has nothing to do with UMotion Community (the free version of UMotion Pro). But you do not necessarily need the Animation Converter to convert a character to generic.

In order to convert your character to generic, first make a backup of your project (if you're using a version control software like SVN or GIT, make a commit; btw. using such software is highly recommended when doing game dev or software dev in general).
Ok, now duplicate your characters fbx file and change it's settings to generic. Create a new UMotion Project of type generic and assign the generic character to the pose editor. In the last step, use the clip import functionality and import the whole humanoid umotion project. Now all the animations you've created in the humanoid project are imported into the generic project and are thus converted to generic. If you now export the animations, they can be used by your generic character.

Regarding the issue you had with the child-of constraint: This might be an issue with the root motion settings of the exported animation clip (shown in the inspector when selecting the exported anim file). It should have nothing to do with IK Pinning.

I hope this sheds some light. Let me know if there is anything else you want to know.


Best regards,
Peter