UMA First-person Integration

I'm attempting to set UMA up properly with two different game objects -- one for arms and one for the body. Normally, you would use FPS Mesh Tool for this, and I've purchased it and tried, but unfortunately it's not compatible with UMADynamicCharacterAvatar:
So I'm trying different approaches. My thought was to duplicate my UMADynamicCharacterAvatar and then just manually hide the arm bones in one and all but the arm bones in the other, but disabling has no effect. You can see here -- disabling the RightUpLeg does nothing visually:
I'm now wondering if perhaps I can just use one UMADynamicCharacterAvatar instance and assign the arm bones in the Character Manager. I'm not familiar enough with how this works and the need for two different models (arms, body) to know if that makes sense to do.

I'm running low on ideas. What's the recommended way to set up UMADynamicCharacterAvatar properly in first person? My goal is to be able to dynamically set clothing at runtime and see the cloths on both the body and arms in First Person mode, for what it's worth.

Thank you very much for the help. I really appreciate it!
 
I wrote to the creator of FPS Mesh Tool to see if he can help at all.

In the meantime, I have been following the first method from that guide (https://opsive.com/support/documentation/ultimate-character-controller/integrations/uma/), namely "Bone Builder."

The part that I'm unsure about is step 6 "Build your character like normal through the Character and Item Managers."

What should I be putting for the reference in "First Person Arms" and "Third Person Objects" fields? Should I just put the UMA bones for arms and head, respectively?
That sounds very straight-forward, so hopefully that's all that's needed, but so much of the documentation refers to having separate objects for body and arms. Would arm animations like holding a gun, etc., still work with this approach? Are there any downsides other than not being able to really optimize the appearance of the arms?

Thank you,
Andrew
 
I haven't FPS Mesh Tool with UMA so I don't have the exact steps but this video should help:
 
Hi Justin,

What about my question about step #6 above? Can I use the same UMA bone structure for both the first person arms and body as I described or do I *need* separate arms for first person to work?

Thank you,
Andrew
 
You need a separate set of arms - take a look at the video above for the steps to get it working with FPS Mesh Tool.
 
3rd Person seems much simper with UMA, since you don't need separate arms. Would it be crazy to use 3rd person for the character/animations/etc. and just place the camera in front of the face to mimic first person? Perhaps hide the head, if needed. What do you think of that approach? Any way to make it workable?
 
I'm sure you can get it working, but unless you have animations that are specifically designed for that setup I'm not sure how good of results you'll get.
 
Hello, I am also working on this issue. What I have done is to create a second UMA with bones and create an item of clothing. In the item of clothing I mask everything but the torso. Then I use UMA's mask to blot out all the torso except the arms. I don't know if this is a great way to do it or not but seems to work. My issue is that I can't get the arms to animate? It doesn't give me an error and I am using the first person arms animator. Thoughts?
 
Thanks Justin, I figured this was the issue. I'm kinda new so looks like I have some studying to do. Thanks for your quick response!
 
@Joejr I'd love to hear more details of how you get this working. I actually gave up for the time being, so I can make some meaningful progress in other parts of my game. I'm going to circle back on this in time, and would love to benefit from your findings. What I was trying to do sounds almost exactly what you're doing. I wanted to use two UMA instances -- one for the body and one for the arms. I wanted to re-use the same humanoid animator for each, to keep it simple and avoid needing to mess with the generic. I was using UMA's "DCA Renderer Manager" to hide specific body parts, as seen here: There is a UMA demo scene which shows it: "UMA Demo - UMARendererAssets"

I hope you have success! Eager to hear how it goes.
 
@AndrewSidereal I got this working using two UMA instances. I had to write a script to spawn the third person uma character, wait until that was created, spawn the "arms" uma model, wait until that was created, then parent the arms to the first person objects game object on the third person and add relevant components. The third person uma character was a normal "Opsive Character" while the first person arms was purely UMA.

Note: I'm using BoltNetwork.Instantiate, but you can replace that with just a normal game object instantation.

Here's the script, hope it helps.

C#:
using System;
using System.Collections;
using Opsive.UltimateCharacterController.Camera;
using Opsive.UltimateCharacterController.Character;
using Opsive.UltimateCharacterController.FirstPersonController.Character.Identifiers;
using Sirenix.OdinInspector;
using UMA;
using UMA.CharacterSystem;
using UnityEngine;

namespace Custom
{
    public class CharacterSpawner : MonoBehaviour
    {
        public CameraController CameraController { set => _cameraController = value; }

        [SerializeField, SceneObjectsOnly, Required]
        private CameraController _cameraController;

        [SerializeField, AssetsOnly, Required]
        private GameObject _baseCharacter;

        [SerializeField, AssetsOnly, Required]
        private GameObject _baseArms;

        private DynamicCharacterAvatar _baseAvatar;
        private DynamicCharacterAvatar _armsAvatar;

        public Action<Transform> OnPlayerSpawned;

        public void SpawnPlayer()
        {
            var character = BoltNetwork.Instantiate(_baseCharacter);
            character.name = _baseCharacter.name;

            _baseAvatar = character.GetComponent<DynamicCharacterAvatar>();
            _baseAvatar.CharacterCreated.AddListener(OnBaseAvatarCreated);
        }

        private void OnBaseAvatarCreated(UMAData data)
        {
            _baseAvatar.CharacterCreated.RemoveListener(OnBaseAvatarCreated);

            var arms = Instantiate(_baseArms);
            arms.name = _baseArms.name;

            _armsAvatar = arms.GetComponent<DynamicCharacterAvatar>();
            _armsAvatar.CharacterCreated.AddListener(OnArmsAvatarCreated);
        }

        private void OnArmsAvatarCreated(UMAData data)
        {
            var firstPersonObjects = _baseAvatar.transform.Find("First Person Objects");

            _armsAvatar.transform.SetParent(firstPersonObjects);
            _armsAvatar.transform.localPosition = Vector3.zero;

            StartCoroutine(AddComponentsDelayed());
        }

        private IEnumerator AddComponentsDelayed()
        {
            yield return new WaitForEndOfFrame();

            _armsAvatar.gameObject.AddComponent<FirstPersonBaseObject>();
            _armsAvatar.gameObject.AddComponent<ChildAnimatorMonitor>();

            _cameraController.Character = _baseAvatar.gameObject;

            OnPlayerSpawned?.Invoke(_baseAvatar.transform);
        }
    }
}

As for hiding the third person model while in first person perspective, I just added a custom PerspectiveMonitor component to wait until the UMA model is created, cache the renderer materials, and just apply the invisible shadow caster material when you toggle into FPS mode. However, this does hide the entire model. If you only wanted to hide specific parts like the arms and head, you can use that DCA Renderer Manager for the head, eyes, etc, but you need to use the Mesh Hiding feature for the torso if the torso has the arms connected. That way you can hide the "third person arms" but keep the torso visible.
 
Top