Answered

Position item not saved

HerQles 3 months ago updated 3 months ago 6

Hi

(Translated using google translate)

I have a problem with changing the position of an added item to my hand. How to add an item to the hand bone (Generic) so that its position can be changed in Umotion and this position will be saved.

In the hand bone I created an empty object (EquipmentHandR) in which the script spawns an item (PrefabV). When creating animations, everything is fine. I set the position of the item and create animations. When running an animation in runtime mode the position/rotation of the item is default without any changes made when creating the animation.
In the timeline (Clip editor) the position/rotation of the item (PrefabV) is saved.
What am I doing wrong?

Image 1350

UMotion Version:
1.29p02
Unity Version:
2022.3.12f1

Answer

Answer
Answered

Hi,
thank you very much for your support request.

If it previews correctly in UMotion the way you described it, this should indeed just work.

  • Maybe a script is overwriting the position of the item?
  • Are you sure you aren't playing an old/outdated version of the animation?
  • Are you adding/removing said item at runtime? It might be necessary to update the internal transform cache of the animator component in this case (I think simply toggling the animator.enable) might be sufficient.
  • Does the exported *.anim preview correctly when viewed using Unity's Animation window?

Please let me know in case you have any follow-up questions.

Best regards,
Peter

Answer
Answered

Hi,
thank you very much for your support request.

If it previews correctly in UMotion the way you described it, this should indeed just work.

  • Maybe a script is overwriting the position of the item?
  • Are you sure you aren't playing an old/outdated version of the animation?
  • Are you adding/removing said item at runtime? It might be necessary to update the internal transform cache of the animator component in this case (I think simply toggling the animator.enable) might be sufficient.
  • Does the exported *.anim preview correctly when viewed using Unity's Animation window?

Please let me know in case you have any follow-up questions.

Best regards,
Peter

Hi

I have located the cause.

I was creating animations for "PrefabV" while during the runtime when I was spawning an item unity gave it the name "PrefabV(clone)" that's why the animations didn't see the item because it was saved to the name "PrefabV".


I have 2 more questions by the way:

I want to make an animation of unscrewing a bottle cap.

What bone should I assign the bottle-nut object to in order to reassign (how to assign) the nut to the left hand during the animation? So that the nut follows the left hand? How should such animations be done with both hands?


And the second question:

How during the creation of the animation to disable the object "PrefabV" I would like it to be hidden in the middle of the animation?

Great to hear that you've found the solution to this problem.

Regarding the bottle cap: You can use the child-of constraint to temporarily make the cap a child of the left hand. Please check out the related video tutorial: https://www.soxware.com/umotion-manual/ProLesson3.html

Regarding disabling an object during an animation, you can use a custom property constraint in "Component Property" mode to animate the "GameObject.active" property (or the Renderer.enabled) property: https://www.soxware.com/umotion-manual/CustomProperty.html#ComponentProperty

Please let me know in case you have any follow-up questions.

Best regards,
Peter

Thank you for your help.

I have one more question for the future.

I want both hands to hold the same object. How do I achieve this effect?

E.g. to have the hands hold a stick on both sides and that it can be easily animated normally and in Inverse Kinematics? or a rifle or a white weapon.

This is possible by using the child-of constraint on the IK handles of the hands. Here are some related forum posts to that question:
https://support.soxware.com/communities/1/topics/1359-how-to-attach-staff-with-two-hands-hold-to-an-animation

https://support.soxware.com/communities/1/topics/100-two-handed-animations-for-gun

Best regards,

Peter

Thank you for your help.

I will be trying to understand this.