Adding New Player & Bots (URGENT)

General support.
Post Reply
User avatar
Lincoln-72
Contributor
Contributor
Posts: 21
Joined: Sun Jun 07, 2020 1:36 pm

Hi There

I am using MFPS Mobile on Unity 2019.3.14f1

Following your documentation and many test with different character assets....Even the packs you recommended in your documentation which I have, I am encountering a big problem here.

After all testing it seems that your Add New Player creation system is Back To Front or shall I say in Reverse........

#1 When Adding A new player and building that player, the character goes into a rifle stance pose without a rifle but your documentation clearly shows that the character is in A-Pose with a rifle, so that"s not right at all.

#2 When building the Bots, the character goes into A-Pose with a rifle instead of the rifle stance pose. I have compared my scene to your documentation and it is not correct!!! I wish I could send you the images I have taken but I cant post attachments here.

What I am trying to say here is that when building a new player he should be in A-Pose with a rifle and when building Bots he should be in rifle aiming pose without the rifle. Your system is doing it back to front here. I have carefully analyzed and double checked this. It does not really matter what character I add the result is the same as I'm describing.

I hope there will be an update or a fix or something, I have 14 characters to add.

I have sent you an email with the images attached.

WITH ALL DO RESPECT - I am bringing this to your attention in case you have not been notified or aware of this problem.

Awaiting your response.

Regards
User avatar
Lovatto
Admin
Admin
Posts: 1834
Joined: Sun Dec 07, 2014 3:18 pm
Contact:

So in resume, you want to the newly added player models assume the aiming position,
the new models are added with the default model position which usually is the T-Pose, that's not an MFPS thing but the model itself,
but you can easily set the aiming position as the default player pose by:

Select one of the TPWeapons (where bl_NetworkGun.cs is attached) in the inspector of the script you will see a button called "Edit Hand Position", click this button and the model will automatically set the aiming position, make sure to close the small window that will appear.

Image
How to find your Invoice Number: Here
How to find your Order Number: Here
User avatar
Lincoln-72
Contributor
Contributor
Posts: 21
Joined: Sun Jun 07, 2020 1:36 pm

Thanks

But how do i get the bots into rifle stance as well? they still in A-Pose
User avatar
Lovatto
Admin
Admin
Posts: 1834
Joined: Sun Dec 07, 2014 3:18 pm
Contact:

Ok, I'll share a simple solution for set any animation as default pose.

Create a new script PoseExtractor.cs and paste this code:

Code: Select all

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif

public class PoseExtractor : MonoBehaviour
{
    public List<Bone> bones = new List<Bone>();

    [ContextMenu("Copy Pose")]
    public void CopyBones()
    {
        bones.Clear();
        Transform[] all = transform.GetComponentsInChildren<Transform>(true);
        for(int i =0; i < all.Length; i++)
        {
            Bone bone = new Bone();
            bone.bone = all[i];
            bone.Position = bone.bone.localPosition;
            bone.Rotation = bone.bone.localRotation;
            bones.Add(bone);
        }
    }

    [ContextMenu("Apply Pose")]
    public void ApplyBones()
    {
        for (int i = 0; i < bones.Count; i++)
        {
            bones[i].bone.localPosition = bones[i].Position;
            bones[i].bone.localRotation = bones[i].Rotation;
        }
    }

#if UNITY_EDITOR
    [CustomEditor(typeof(PoseExtractor))]
    public class PoseExtractorEditor : Editor
    {
        PoseExtractor script;

        private void OnEnable()
        {
            script = (PoseExtractor)target;
        }

        public override void OnInspectorGUI()
        {
           if(GUILayout.Button("Copy Pose"))
            {
                script.CopyBones();
                EditorUtility.SetDirty(target);
            }
            GUI.enabled = script.bones.Count > 0;
            if (GUILayout.Button("Set Pose"))
            {
                script.ApplyBones();
            }
            GUI.enabled = true;
        }
    }
#endif

    [System.Serializable]
    public class Bone
    {
        public Transform bone;
        public Vector3 Position;
        public Quaternion Rotation;
    }
}
1 - Select the player model where the Animator component is and add this script (PoseExtractor).
2 - Open the animation window with CTRL + 6 or Window -> Animation -> Animation.
3 - Select the animation from the animation list in the window and set the frame to where you want to set as the default pose.
4 - Go to the inspector window and in the script PoseExtractor -> click on the "Copy Pose" button.
5 - Close the Animation window and then again in the PoseExtractor inspector click on the "Set Pose".
How to find your Invoice Number: Here
How to find your Order Number: Here
User avatar
Lincoln-72
Contributor
Contributor
Posts: 21
Joined: Sun Jun 07, 2020 1:36 pm

Hi

Thank you

It works :)
Post Reply