0 votes
asked in General Help by

Hi, i'd want to make pickup/reload animations and i'm currently trying to make a small proof of concept umotion project to make it work.

I've setup my humanoid rig and i've added a few cubes (which can represent an object i'm holding/grabbing for example) to the root. Here's what it looks like:

The goal is, in an extremely crude way, to pick the first cube ("Magazine", orange color) with one arm, making it a child of the character's left hand, lifting it, throwing it upwards, catching it, then putting it on the other cube ("Gun", cyan color) and lastly linking it to that second cube.

Now, if i was working with a generic rig i wouldn't have any issue, as after importing "Character_Stickman" i'll be able to animate both cubes' properties (position, rotation and scale) and i'll be able to use the child of constraint to "link it" to a parent. This is what it looks like after importing:

However i am using a humanoid rig, which means i can't animate the cubes' properties.

I've tried adding a custom property as a child of one of the cubes, but i couldn't animate the cube with it:

I'm assuming the objects i'm trying to animate (in this case, the two cubes) have to be a child of the object i'm importing when creating the umotion project.

Is there a way to accomplish what i'm trying to do?

1 Answer

0 votes
answered by Expert (155k points)
Best answer
Hi Ivan,
thank you very much for your support request.

You can animate non humanoid bones in a humanoid project, but only if the object is at least a child of the hips. You also have to set it's visibility to "show" in the "properties" tab in Config Mode, as by default, non humanoid bones are disabled in humanoid projects.

Once you've made the object visible, you can work with it just like in a generic project.

Please let me know if you have any further questions.

Best regards,
commented by
Tested and it works!

However i'm now encountering another issue (it may however not be related to umotion): i've made a script that periodically istantiates a cube setting it as a child of the hips and setting the name name i've used when creating the animation, then destroying it after a delay (the goal is to simulate a magazine conveniently spawning during the reload animation).

Unfortunately the animator does not animate the cube.

I've then tried changing approach by changing the parent of the cube between hips and null, without instantiating and destroying it.

If i do that it'll only work if the cube started as a child of the hips when i press the play button (null -> hips doesn't animate, hips->null->hips does).

Having everything i'm ever going to animate instantiated in my player gameobject is impossible, do you know any workaround?
commented by Expert (155k points)
Seems like the Animator is caching references to Transforms. You could try disable and enabling the Animator component (animator.enable) after you've changed something in the transform hierarchy. This will most probably also reset your animator state machine, though.

Another workaround would be that you simply animate the visibility of your magazine. You can do this using a custom property constraint in "Component Property" mode (see "Pose Editor --> Constraint System --> Custom Property Constraint" in the UMotion manual).

Best regards,
commented by

Strangely disabling and enabling the animator doesn't work either, regardless of whether i do both in a single frame, on separate frames or through the inspector directly by unchecking and checking the animator component.

It doesn't quite reset the state machine either, when enabling the animator all parameters are restored to the previous values and the animation will resume where it left.

I'd really need to add the object i'm animating on runtime since since i'm planning to add the ability to pick up a lot of items. For example if i had 20 different objects on the ground i'd need to copy all of them as a child of my character's hips. If i create those objects over time then that'd be impossible without some sleight of hand (such as making the object i'm picking up disappear, replace it with the one that is a child of hips, do the animation, then replace the two objects).


Changing the update mode from normal to either animate physics or unscaled time works, but only if i do it through the editor, i've seen nothing happen when changing back and forth using my script.


I've been testing animator methods and i eventually found one that worked:


The short description in unity's documentation was a bit misleading but the verbose one is spot on.

Now everything works as expected, thank you for your help, have a great day! :D

commented by Expert (155k points)
Great to hear that you've got it working. Now that you mention that method, I remember that I've also used that one in UMotion's source code (for resetting the Animator).

Best regards,

Soxware Support

Here you get official product support by the developer and the community for all Soxware Products for Unity®.

Post as guest, login via Facebook or create an account.

Ask questions, report bugs or provide feedback. Please use the correct category and always post in english.

For private email support, please use the Support Form to create a support ticket.

Copyright © 2017 Soxware Interactive | All Rights Reserved | Impressum