Answered

How to attach props to prop bones without adding them to the project?

Quintin 1 month ago updated 1 month ago 2

Our project has prop bones set up in our skeleton (eg. RightHandPropBone) and we attach props (eg. Sword) to that prop bone at runtime.

When creating animations with Umotion, it's very useful to be able to attach the actual prop to the prop bone at edit time (in this example, parenting Sword to RightHandPropBone) so that we can animate RightHandPropBone with the correct visual in the editor.

However when the sword is attached in this way, UMotion wants to add Sword to the project file the moment I drag the character into the Pose Editor. I don't want to add Sword to the project because it's not actually a bone (it's just a prop parented to a bone). There's also hundreds of props and a dozen characters, so I definitely don't want to add all those props to each of the project files.

How can this be resolved? Thanks!

UMotion Version:
1.24
Unity Version:
2020.2.5

Answer

Answer
Answered

Hi Quintin,

thank you very much for your support request.

You can set "visibility" to "locked" in the config mode (for the props). This ensures that the props are not included in the exported animation data and that there is no visible representation of the props transform in the UMotion editor.

If you really don't want it to be included in the project, then you can use the UMotion callback system to write a short script that just moves the prop as if it would be parented to the hand (but is not an actual child in the hierarchy). More information regarding the callback system can be found in the manual at "Pose Editor --> Options" headline "Extending UMotion".

public class PropPreview : MonoBehaviour
{
    public Transform Prop = null;
    
    private void UMotionUpdate() // <== Use this name in the UMotion callback settings
    {
        Prop.SetPositionAndRotation(transform.position, transform.rotation);
    }
}

(Wrote the script out of my head --> untested.)


Assign this script to your UMotion prop anchor and assign the prop you want to preview to the "Prop" field. Make sure that the prop is a separate GameObject and NOT a child of the actual character. Feel free to further improve this preview script (e.g. to contain references to all props and show them as needed).


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

Best regards,
Peter

Answer
Answered

Hi Quintin,

thank you very much for your support request.

You can set "visibility" to "locked" in the config mode (for the props). This ensures that the props are not included in the exported animation data and that there is no visible representation of the props transform in the UMotion editor.

If you really don't want it to be included in the project, then you can use the UMotion callback system to write a short script that just moves the prop as if it would be parented to the hand (but is not an actual child in the hierarchy). More information regarding the callback system can be found in the manual at "Pose Editor --> Options" headline "Extending UMotion".

public class PropPreview : MonoBehaviour
{
    public Transform Prop = null;
    
    private void UMotionUpdate() // <== Use this name in the UMotion callback settings
    {
        Prop.SetPositionAndRotation(transform.position, transform.rotation);
    }
}

(Wrote the script out of my head --> untested.)


Assign this script to your UMotion prop anchor and assign the prop you want to preview to the "Prop" field. Make sure that the prop is a separate GameObject and NOT a child of the actual character. Feel free to further improve this preview script (e.g. to contain references to all props and show them as needed).


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

Best regards,
Peter

Oh great thank you! :) I will try out the callback method!