Search Unity

PuppetMaster - Advanced Character Physics Tool [RELEASED]

Discussion in 'Assets and Asset Store' started by Partel-Lang, Oct 1, 2015.

  1. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,891
    Hey,
    Yes, if you have bones, it is possible ("Partial Pinning" demo in the package).

    Hey,
    Please add this segment to the top of PuppetMasterModes.cs:
    Code (CSharp):
    1. /// <summary>
    2.         /// Switches this PuppetMaster to PuppetMaster.Mode.Active.
    3.         /// </summary>
    4.         public void SwitchToActiveMode()
    5.         {
    6.             mode = Mode.Active;
    7.         }
    8.  
    9.         /// <summary>
    10.         /// Switches this PuppetMaster to PuppetMaster.Mode.Kinematic.
    11.         /// </summary>
    12.         public void SwitchToKinematicMode()
    13.         {
    14.             mode = Mode.Kinematic;
    15.         }
    16.  
    17.         /// <summary>
    18.         /// Switches this PuppetMaster to PuppetMaster.Mode.Disabled.
    19.         /// </summary>
    20.         public void SwitchToDisabledMode()
    21.         {
    22.             mode = Mode.Disabled;
    23.         }
    I will add this change into the next version too.

    Hey,
    The manual. If you have any specific suggestions to improve it, I'd be happy to hear them. Also, there is quite a lot of information in the tooltips of PuppetMaster and BehaviourPuppet components and some tutorials here.

    Best,
    Pärtel
     
    ksam2 likes this.
  2. flow-

    flow-

    Joined:
    Apr 19, 2015
    Posts:
    126
    Hey, i got some problems with a very unusual situation.
    I want that the player is able to Climb up this Mammoth.
    2mammoth.png

    I use Puppet Master now like a half year and i wonder if i can do this with Props.
    I already have created anchor Points and Instantiated Props on this anchor points, it works somehow when i add a FixedJoint between this but the problem is that the prop totally freaks out, i think it's because the Fixed Joint is to static and interference with the Configurable Joint.

    Any Suggestions how i can just connect the ragdoll on this anchor points?

    EDIT:
    I realized it's a problem on the PhysX Joints, they just become unpredictable and getting unstable when i try to connect a ragdoll on it...
    I try now to create a pivot point on the character Hips while he is in the air so i can work locally with the extremities joints to not have the full weight on the extremities.
     
    Last edited: May 22, 2019
  3. docseuss

    docseuss

    Joined:
    Apr 5, 2016
    Posts:
    36
    Pärtel,
    Just want to say that I have been really enjoying PuppetMaster and FinalIK. However I was trying to attach PuppetMaster and FinalIK to UMA 2.8 and the examples you provide are a bit outdated as with 2.8 they changed the UMA stuff quite a bit. Anyhow I have updated and changed your scripts to work with UMA 2.8 and thought I would post them here for others to use.

    To use these scripts just add AttachPuppetMaster and AttachFinalIK to your UMA Avatar and then in the UMA Created Events just reference them (See screenshot).

    AttachPuppetMaster
    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using RootMotion.Dynamics;
    4. using UMA.CharacterSystem;
    5. using RootMotion;
    6. using GambitMonkey.Utils;
    7.  
    8. namespace GambitMonkey.UMA {
    9.  
    10.     public class AttachPuppetMaster : MonoBehaviour {
    11.  
    12.         [Header("Assign Avatar To Build")]
    13.         public DynamicCharacterAvatar avatar;
    14.  
    15.         [Tooltip("The layer to assign the character controller to. Collisions between this layer and the 'Ragdoll Layer' will be ignored, or else the ragdoll would collide with the character controller.")]
    16.         [LayerAttribute]
    17.         public int characterControllerLayer;
    18.  
    19.         [Tooltip("The layer to assign the PuppetMaster and all it's muscles to. Collisions between this layer and the 'Character Controller Layer' will be ignored, or else the ragdoll would collide with the character controller.")]
    20.         [LayerAttribute]
    21.         public int ragdollLayer;
    22.  
    23.         [Header("PuppetMaster Config")]
    24.         public PuppetMasterHumanoidConfig humanoidConfig;
    25.  
    26.         [Tooltip("Ragdoll Collider customizations")]
    27.         [Header("Ragdoll Colliders")]
    28.         public float footCorrectionAngle = 30f;
    29.         public Vector3 headColliderCenter = new Vector3(-0.03f, 0f, .04f);
    30.         public float headColliderRadius = 0.1f;
    31.         public float headColliderHeight = 0.3f;
    32.                
    33.         [Header("Behaviours")]
    34.         public BehaviourBase[] behaviourPrefabs;
    35.  
    36.         public void AddPuppetMaster()
    37.         {
    38.             if (avatar != null)
    39.             {
    40.                 // Auto-generate a ragdoll and set up PuppetMaster to an UMADynamicAvatar
    41.                PuppetMaster pm = PuppetMasterUMATools.SetUp(avatar, characterControllerLayer, ragdollLayer, OnEditOptions, OnEditRagdoll);
    42.  
    43.                 // Add the behaviours
    44.                 Transform behaviourRoot = avatar.transform.parent.Find("Behaviours");              
    45.  
    46.                 foreach (BehaviourBase prefab in behaviourPrefabs)
    47.                 {
    48.                     BehaviourBase behaviour = (BehaviourBase)GameObject.Instantiate(prefab, avatar.transform.position, avatar.transform.rotation);
    49.                     behaviour.transform.parent = behaviourRoot;
    50.  
    51.                     if (behaviour is BehaviourPuppet)
    52.                     {
    53.                         // Ignore collisions with BehaviourPuppet collision layers and the character controller layer
    54.                         int[] indexes = LayerMaskExtensions.MaskToNumbers((behaviour as BehaviourPuppet).collisionLayers);
    55.  
    56.                         foreach (int index in indexes)
    57.                         {
    58.                             Physics.IgnoreLayerCollision(avatar.gameObject.layer, index);
    59.                         }
    60.                     }
    61.                 }
    62.  
    63.                 /*
    64.                 if (behaviourPuppetPrefab != null && behaviourFallPrefab != null) {
    65.                     Transform behaviours = avatar.transform.parent.FindChild("Behaviours");
    66.  
    67.                     GameObject puppet = (GameObject)GameObject.Instantiate(behaviourPuppetPrefab, avatar.transform.position, avatar.transform.rotation);
    68.                     puppet.transform.parent = behaviours;
    69.  
    70.                     GameObject fall = (GameObject)GameObject.Instantiate(behaviourFallPrefab, avatar.transform.position, avatar.transform.rotation);
    71.                     fall.transform.parent = behaviours;
    72.  
    73.                     // Ignore collisions with BehaviourPuppet collision layers and the character controller layer
    74.                     int[] indexes = LayerMaskExtensions.MaskToNumbers(puppet.GetComponent<BehaviourPuppet>().collisionLayers);
    75.                     foreach (int index in indexes) {
    76.                         Physics.IgnoreLayerCollision(avatar.gameObject.layer, index);
    77.                     }
    78.                 }
    79.                 */
    80.  
    81.                 //Sets the values of the UMA PuppetMaster from a humanoid config
    82.                 if (pm != null && humanoidConfig != null)
    83.                 {
    84.                     pm.humanoidConfig = humanoidConfig;
    85.                 }
    86.  
    87.                 Debug.Log("PuppetMaster successfully set up with " + avatar.name);
    88.                 avatar = null; // Do not set up to the same avatar again (we're in Update)
    89.             }
    90.         }
    91.  
    92.         void OnEditOptions(ref BipedRagdollCreator.Options options) {
    93.             /* // Params of BipedRagdollCreator.Options that you can specify here, just for reference
    94.             options.weight *= 2f; // Double the mass of the character
    95.             options.spine = false; // No spine collider
    96.             options.chest = false; // No chest collider
    97.             options.hands = false; // No hand colliders
    98.             options.feet = false; // No foot collider
    99.  
    100.             options.jointRange = 2f; // Make the joint limits double as wide
    101.  
    102.             options.colliderLengthOverlap = 0.1f; // Make the colliders overlap each other a bit more
    103.             options.torsoColliders = RagdollCreator.ColliderType.Capsule; // Use CapsuleColliders for the torso
    104.             options.headCollider = RagdollCreator.ColliderType.Box; // Use BoxCollider for the head
    105.             options.armColliders = RagdollCreator.ColliderType.Box; // Use BoxColliderss for the arms
    106.             options.handColliders = RagdollCreator.ColliderType.Box; // Use BoxColliders for the hands
    107.             options.legColliders = RagdollCreator.ColliderType.Box; // Use BoxColliders for the legs
    108.             options.footColliders = RagdollCreator.ColliderType.Capsule; // Use CapsuleColliders for the feet
    109.             */                      
    110.         }
    111.  
    112.         // Called by PuppetMasterUMATools when the ragdoll has been created, but before setting it up with PM
    113.         void OnEditRagdoll(BipedRagdollReferences references) {
    114.             // Make programmatic adjustmets to the auto-generated ragdoll if necessary
    115.            
    116.             // We can rotate the feet of the ragdoll to account for the foot bone orientatios not being aligned with the ground
    117.             Quaternion footCorrection = Quaternion.Euler(0f, footCorrectionAngle, 0f);
    118.             references.leftFoot.localRotation = footCorrection * references.leftFoot.localRotation;
    119.             references.rightFoot.localRotation = footCorrection * references.rightFoot.localRotation;
    120.  
    121.             // If using CapsuleCollider for the head
    122.             var headCapsule = references.head.GetComponent<CapsuleCollider>();
    123.             if (headCapsule != null)
    124.             {
    125.                 headCapsule.center += headColliderCenter;
    126.                 headCapsule.radius = headColliderRadius;
    127.                 headCapsule.height = headColliderHeight;
    128.             }
    129.  
    130.             // If using BoxCollider for the head
    131.             //var headBox = references.head.GetComponent<BoxCollider>();
    132.             //if (headBox != null)
    133.             //{
    134.             //    headBox.center += headColliderCenter;
    135.             //    headBox.size *= 0.1f;
    136.             //}
    137.         }
    138.     }
    139. }
    140.  
    PuppetMasterUMATools
    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using UMA.CharacterSystem;
    4. using RootMotion.Dynamics;
    5.  
    6. namespace GambitMonkey.UMA {
    7.  
    8.     public class PuppetMasterUMATools : MonoBehaviour {
    9.  
    10.         public delegate void EditOptions(ref BipedRagdollCreator.Options options);
    11.         public delegate void EditRagdoll(BipedRagdollReferences references);
    12.  
    13.         public static PuppetMaster SetUp(DynamicCharacterAvatar avatar, LayerMask characterControllerLayer, LayerMask ragdollLayer, EditOptions OnEditOptions = null, EditRagdoll OnEditRagdoll = null)
    14.         {
    15.             if (avatar == null) {
    16.                 Debug.Log("UMADynamicAvatar is null, can not set up PuppetMaster");
    17.                 return null;
    18.             }
    19.  
    20.             Animator animator = avatar.GetComponent<Animator>();
    21.  
    22.             if (animator == null) {
    23.                 Debug.Log("UMADyncamiAvatar has no Animator component, can not set up PuppetMaster");
    24.                 return null;
    25.             }
    26.  
    27.             GameObject ragdoll = GameObject.Instantiate(animator.gameObject, animator.transform.position, animator.transform.rotation);
    28.             Animator ragdollAnimator = ragdoll.GetComponent<Animator>();
    29.  
    30.             Transform newRagdollRoot = new GameObject("Ragdoll Root").transform;
    31.             newRagdollRoot.position = animator.transform.position;
    32.             newRagdollRoot.rotation = animator.transform.rotation;
    33.             newRagdollRoot.parent = animator.transform.parent;
    34.             ragdoll.transform.GetChild(0).parent = newRagdollRoot;
    35.  
    36.             // Find bones (UMA)
    37.             BipedRagdollReferences r = BipedRagdollReferences.FromAvatar(ragdollAnimator);
    38.            
    39.             r.root = newRagdollRoot;
    40.             BipedRagdollCreator.Options options = BipedRagdollCreator.AutodetectOptions(r);
    41.            
    42.             // Edit options here if you need to
    43.             if (OnEditOptions != null) OnEditOptions(ref options);
    44.  
    45.             BipedRagdollCreator.Create(r, options);
    46.  
    47.            if (OnEditRagdoll != null) OnEditRagdoll(r);
    48.            
    49.             PuppetMaster pm = PuppetMaster.SetUp(animator.transform, newRagdollRoot, characterControllerLayer, ragdollLayer);          
    50.  
    51.             DestroyImmediate(ragdollAnimator);
    52.             DestroyImmediate(ragdoll);
    53.            
    54.             animator = null;
    55.             return pm;
    56.         }
    57.     }
    58. }
    59.  
    AttachFinalIK
    Code (CSharp):
    1.  
    2. using RootMotion;
    3. using RootMotion.FinalIK;
    4. using UnityEngine;
    5. using static RootMotion.FinalIK.GrounderFBBIK;
    6.  
    7. namespace GambitMonkey.UMA
    8. {
    9.     public class AttachFinalIK : MonoBehaviour
    10.     {
    11.         FullBodyBipedIK ik;
    12.         GrounderFBBIK gk;
    13.      
    14.         public LayerMask groundLayer;
    15.         public SpineEffector[] spine;
    16.      
    17.         public void AddFBBIK()
    18.         {
    19.             BipedReferences references = null;
    20.             GameObject go = this.gameObject;
    21.  
    22.             if (references == null)
    23.             { // Auto-detect the biped definition if we don't have it yet
    24.                 BipedReferences.AutoDetectReferences(ref references, go.transform, BipedReferences.AutoDetectParams.Default);
    25.             }
    26.             ik = go.AddComponent<FullBodyBipedIK>(); // Adding the component          
    27.             ik.SetReferences(references, null);
    28.             ik.solver.SetLimbOrientations(BipedLimbOrientations.UMA); // The limb orientations definition for UMA skeletons
    29.             Debug.Log("Successfully Added FBBIK");
    30.         }
    31.  
    32.         public void AddGrounderFBBIK()
    33.         {
    34.             GameObject go = this.gameObject;
    35.  
    36.             //Add GrounderIK for feet orientation
    37.             gk = go.AddComponent<GrounderFBBIK>();
    38.             if (ik != null)
    39.             {
    40.                 gk.ik = ik;
    41.                 gk.solver.layers.value = groundLayer.value;
    42.                 gk.spine = spine;
    43.                 Debug.Log("Successfully Added GrounderFBBIK");
    44.             }
    45.         }
    46.     }
    47. }
    48.  
    LayerMaskSingleEditor
    Code (CSharp):
    1.  
    2. using GambitMonkey.Utils;
    3. using UnityEditor;
    4. using UnityEngine;
    5.  
    6. namespace GambitMonkey.Editors
    7. {
    8.     [CustomPropertyDrawer(typeof(LayerAttribute))]
    9.     public class LayerMaskSingleEditor : PropertyDrawer
    10.     {
    11.         public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    12.         {
    13.             EditorGUI.BeginProperty(position, label, property);
    14.             int index = property.intValue;
    15.             if (index > 31)
    16.             {
    17.                 Debug.Log("CustomPropertyDrawer, layer index is to high '" + index + "', is set to 31.");
    18.                 index = 31;
    19.             }
    20.             else if (index < 0)
    21.             {
    22.                 Debug.Log("CustomPropertyDrawer, layer index is to low '" + index + "', is set to 0");
    23.                 index = 0;
    24.             }
    25.             property.intValue = EditorGUI.LayerField(position, label, index);
    26.             EditorGUI.EndProperty();
    27.         }
    28.     }
    29. }
    30.  
    31.  
    LayerAttribute
    Code (CSharp):
    1.  
    2. using UnityEngine;
    3.  
    4. namespace GambitMonkey.Utils
    5. {
    6.     /// <summary>
    7.     /// Attribute to select a single layer.
    8.     /// </summary>
    9.     public class LayerAttribute : PropertyAttribute
    10.     {
    11.     }
    12. }
    13.  
     

    Attached Files:

    Last edited: May 25, 2019
  4. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,891
    Hey,
    Would also like to point out that if you add joints that connect the PuppetMaster ragdoll to anything else, you'll have to set pin weight to 0 for the puppet or at least the body part that was connected, because the pinning forces would try to keep the ragdoll pinned to the animation and the added joint would conflict with that and they would end up pulling the ragdoll to pieces when the forces get big enough.

    Hey, thank you very much for sharing, appreciate that!
    I'll try to update the integration for the next version. It is crazy, game tech evolution seems to be accelerating exponentially these days, so many updates to everything, including Unity.

    Best,
    Pärtel
     
  5. XDura

    XDura

    Joined:
    Oct 27, 2016
    Posts:
    26
    Hi!, if I change a skin of the player at runtime, so all the targetTransforms are destroyed and recreated.
    How can I rebuild the puppet?
    I manually went over all muscles assigning the new TargetTransforms and did a PuppetMaster.Initiate but it doesn't work

    Thanks
     
  6. growling_egg

    growling_egg

    Joined:
    Sep 2, 2012
    Posts:
    40
    Hello! I am enjoying PuppetMaster, and read somewhere that there's an integration in the works for Opsive Ultimate Character Controller? I'm making a fighting game and if I could use FIK, PM, and UCC all at once it would be so cool! Thanks!
     
    Deckard_89 likes this.
  7. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,891
    Hey,
    The best way to have multiple skins per character would be to just have multiple SkinnedMeshRenderers that use the same rig. Switching them would be easy. If the bone hierarchies don't match, then you can't share the PuppetMaster rig, you should have a puppet rig for each skin and instantiate the one you wish to use.

    Hey,
    Yes, it has been delayed for a while now for other priorities, but I'll pick it up again since you asked :).

    Cheers,
    Pärtel
     
  8. growling_egg

    growling_egg

    Joined:
    Sep 2, 2012
    Posts:
    40
    You're the man! I appreciate it very much. I know there's at least a handful of us out there for whom this would be the secret sauce to some really fun stuff.

    Thanks again!
     
  9. jfonz001

    jfonz001

    Joined:
    Jul 19, 2017
    Posts:
    5
    UPDATE:
    I think I figured it out. I had to give my Player controller a rigidbody and set the animation controller to this:

    Apply Root Motion: Unchecked
    Update Mode: Animate Physics
    Culling Mode: Always animate

    There is still some slight stuttering, probably just due to my awful walking animations and whatnot. My plan is to disable the puppet until I need it anyway.

    I do notice though that if I disable the puppet master and then re-enable it, my character's arms seem to fly back to their initial position when the scene started. Kinematic works fine though. Any idea why that might be? Thanks.

    Hey Partel,

    I am having trouble with my player "stuttering" while moving. I am using Aron's A* Pathfinding to move my characters. I have stripped down my player to pretty much just the model, puppet, and controller (no behaviors). In the stripped down version it seems to be smooth, so I think it may be something I am doing...that being said I then took my stuttering player (the full version) and stripped out all but the essential components and I am still experiencing the stutter. The scripts remaining on the player after this shouldn't be having any impact and at that point both versions of the player are using the same methods to move across the world.

    I made a video to help explain. The stuttering doesn't seem as bad here but if you notice, the unit closer to the camera is stuttering while the far (stripped down) unit is much smoother. Please ignore the error messages you might notice at the bottom, those are in regards to some missing components that are in my test scene and are unrelated to movement (just saving, loading, scene management etc.)



    Both units have a box collider on their controller. All colliders (the box and the puppet colliders) are set to "Player" and should not collide with eachother.

    I also see that the feet are dragging in both cases, but I think that is a separate issue as the dragging feet doesn't seem to be slowing down or causing the stuttering in the stripped down unit.
    Thank you
     
    Last edited: Jun 1, 2019
  10. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,891
    Hey,
    If there is stuttering only noticeable from a camera view point, it is because the motion of the camera and the motion of the puppet are out of sync. If your camera is updated in LateUpdate, make sure to add your camera updating script to a higher value than PuppetMaster.cs has in the Script Execution Order. Then also enable Interpolation on all the ragdoll Rigidbodies. Also make sure the character controller rigidbody is set to interpolate if you have it.

    Best,
    Pärtel
     
  11. gliealonso

    gliealonso

    Joined:
    Oct 21, 2018
    Posts:
    8
    Hello there,

    I started using the new PuppetMaster, and I noticed that my characters now stay a about 2 meters floating on the air, and I even tried to recreate the from scratch, and the issue still happpened, such as the image below:
    upload_2019-6-9_21-15-21.png

    And I also noticed this message that I didn't understand:
    upload_2019-6-9_21-16-46.png

    Is this happening with anyone else?

    Warmest regards,
    Gabriel.
     
  12. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,891
    Hey,
    Haven't seen this problem before. Any chance you could send me a repro or some instructions to reproduce the issue?

    Best,
    Pärtel
     
  13. jfonz001

    jfonz001

    Joined:
    Jul 19, 2017
    Posts:
    5
    Hey Partel,

    I'm hitting this error when equipping a prop to my characters.

    https://imgur.com/a/Q0PImec

    This only happens if I try and equip the prop as soon as I hit play. If I use a coroutine to wait a few seconds before actually equipping the prop I do not get this error, so I'm wondering if it's a race-case sort of thing.

    I added some values to your debug message to try and see what is going on. As you can see the positions between the two are just slightly off. I'm wondering if it's because I am not having the unit "pick up" them items, but instead am instantiating a new clone of a prefab and then immediately equipping the prop to the prop root. Again, seems to work fine if I wait a few seconds (or even equip the prop normally mid-game). It just seems to happen if equipping right when the game starts and I'm wondering if maybe my scripts are running before your scripts are ready?

    Thanks

    Edit: I just wanted to add that I have basically applied a band-aid coroutine that waits a few seconds before equipping items after I run the game in the editor. I just wait one second, then continue on, and I don't hit this error and the prop is equipped just fine. I am pretty sure that I am equipping the prop "too soon", before something in puppet master is ready, perhaps. Any clue what that might be?
     
    Last edited: Jun 15, 2019
  14. gliealonso

    gliealonso

    Joined:
    Oct 21, 2018
    Posts:
    8

    Hi Partel,

    So I even tried creating a new project and reinstalling Final IK and the newest PuppetMaster.

    What I do is, I create a full body biped ik, then use the ragdoll creator, then create the puppetmaster, and that is it. It used to work perfectly before, but now my character just suddenly goes up 2 meters above the air.

    Looking forward to hearing from you.
    Warmest regards,
    Gabriel.
     
  15. jfonz001

    jfonz001

    Joined:
    Jul 19, 2017
    Posts:
    5
    Hey I'm no expert by any means, but that warning message in your screen shot is basically saying that when you create the Puppet it will separate the instance you are working on from it's prefab. So basically you just have to make a new prefab.

    For your issue, I would check and make sure that all elements of your character (the mesh, the armature, the puppet, the controller) are all set to the same position. You can also make sure that the ragdoll or puppetmaster colliders and the character controller colliders are playing nice and not set to collide with each other. Maybe they are pushing each other around?
     
  16. gliealonso

    gliealonso

    Joined:
    Oct 21, 2018
    Posts:
    8
    Thanks for your reply, JFonz.

    The mesh, armature and puppet all seem fine, it was working before, and I did make the colliders not collider with each other.

    Not sure why this is happening now, but I am in no hurry to fix it though hehe

    Thanks for your reply once again,
    Gabriel.
     
  17. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,891
    Hey, thanks for sending me the model, I just replied to your email.

    Best,
    Pärtel
     
    gliealonso likes this.
  18. BenWoodford

    BenWoodford

    Joined:
    Sep 29, 2013
    Posts:
    51
    Started playing with this today but having a peculiar issue - when using Frozen after the kill time the rig does this weird thing where it rotates to be semi-upright but with all the bone positions it had on the floor. Like it's been frozen solid and picked up. It seems like it's setting it back to the origin of the parent maybe?
     
  19. gliealonso

    gliealonso

    Joined:
    Oct 21, 2018
    Posts:
    8
    Hi Partel,

    I hope you are well.

    Could you please help me with an issue with the Prop Master Melee?

    On the weapon prop, it needs a RigidBody, and I am using that rigid body to get collisions and velocity speed, however when I start the game, the rigid body is destroyed
    upload_2019-6-24_20-12-30.png
    upload_2019-6-24_20-13-14.png
    upload_2019-6-24_20-13-59.png

    Do you know what could be the issue?

    Many thanks!
    Gabriel.
     

    Attached Files:

  20. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,891
    Hey,
    I haven't seen this issue before. Can you please let me know how I could reproduce this issue in one of the demo scenes maybe or send me a repro that I could take a look at?

    Hey,
    The new prop system needs to destroy the rigidbody when the prop is attached to the ragdoll. That is for performance reasons, as the prop muscle already has a rigidbody. It adds the rigidbody back when the prop is dropped.
    So if you have references to the prop rigidbody in your own scripts, change them to this:

    Code (CSharp):
    1. public Rigidbody rigidbody {
    2. get {
    3. if (_rigidbody == null) _rigidbody = GetComponent<Rigidbody>();
    4. return _r;
    5. }
    6. }
    7. private Rigidbody _rigidbody;
    Best,
    Pärtel
     
  21. jfonz001

    jfonz001

    Joined:
    Jul 19, 2017
    Posts:
    5
    Hey Partel,

    EDIT: I think I can do this by playing with Collision Resistance, but any other input is much appreciated, especially on how to make my player's sword less "floppy", life a wiffle ball bat.

    I'm working on Melee combat. When my attacker swings at his target he doesn't seem to be able to transfer the force of the blow completely to the target. The target puppet flinches a little, but the attacker's weapon will glance off. If the attacker is standing too close and his arms also hit the target, it's as if the attacker is crashing against a wall and he will sort of crumble to the ground.

    Occasionally, I can angle my attacker just right to where his weapon follows completely through most of the animation and the target is slammed to the ground by the force of the blow. This is more what I'm looking for.

    Is there some sort of settings for making certain animations "more rigid"?

    I am only using the Puppet Behavior with no animations on fall. If the puppet is hit hard enough they will go down.
     
    Last edited: Jul 2, 2019
  22. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,891
    Hey,
    First, make sure the layer of the prop is included in BehaviourPuppet's "Collision Layers".
    Also increasing the mass of the prop helps.

    It will probably not be enough punch still, so you might need to make use of the Boosters like in the Melee demo. Boosters give temporary immunity and/or impulse magnification (damaging other puppets more) to the puppet.
    Declare a
    Code (CSharp):
    1. public Booster booster;
    and fill it in in the editor. Set Groups to Prop and Hand, Immunity to maybe 0.5f and Impulse Mlp to something like 5.
    When you trigger the attack animation, call
    Code (CSharp):
    1. booster.Boost(behaviourPuppet);
    .
    The duration of the boosting effect is defined by "Boost Falloff" in BehaviourPuppet.

    Best,
    Pärtel
     
  23. kvachanpavel_unity

    kvachanpavel_unity

    Joined:
    Jul 6, 2019
    Posts:
    1
    Hi Partel:
    I bought and now try to combine the puppet master and final ik and ran into a problem. When I change the position of the effector bone final ik, the remaining bones of the character are pulled to the starting position. Also in the puppet master I set the Pin Weight to 1 and I basically lost all the physicality of the character. I would like to get a character's behavior like that of Clumsy Ninja, when we lift the character above the ground for some kind of limb. I looked at all the examples (including Mapping To Ragdoll), but could not find a solution. Maybe there are some ideas on how to do this?
     

    Attached Files:

  24. borkbork

    borkbork

    Joined:
    Jul 5, 2014
    Posts:
    28
    Hi Partel, kudos for the excellent work. I am working on integrating PM with Ootii's MC - I found an update to your integration package on this forum "Ootid's Motion Controller v2.73 (Unity 5.5.0)". Just wondering if this forum is the best place to find these kinds of things / if this is the most recent package?
     
  25. borkbork

    borkbork

    Joined:
    Jul 5, 2014
    Posts:
    28
    Curious, is it possible to dismember a PM rag doll?
     
  26. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,891
    Hey,
    In FBBIK, if you set "Pull" weight to 0 for all the limbs except for the one that you pull from, you will be able to drag the character as far as you like.. But that's not how you do stuff like pulling that ninja by its hand. To drag a puppet physically, add a FixedJoint between the hand rigidbody and a kinematic rigidbody, then set pin weight to 0 in PuppetMaster or if using BehaviourPuppet, call behaviourPuppet.SetState(BehaviourPuppet.State.Unpinned); and set behaviourPuppet.canGetUp to false until the hand is released. Then it will be pretty much like the "Hanging" demo in PuppetMaster.

    Hey,
    I update the integration packages every time I push a new version, but 3rd party publishers update their stuff quite often sometimes breaking the integration. I don't get notified about those updates unless one of you guys writes to me here so I also reply here with a solution. I should make a page on the website with all the patches and updates easier to find, I'll figure something out ASAP..

    Hey,
    Yes, please check out the "Removing Muscles" demo. The next version will have a new much more efficient and performant API for dismemberment, that doesn't remove muscles, which is a very slow and GC allocating thing to do. Instead, it will basically just set joint X/Y/ZMotion to Free, that costs close to nothing.
    PM doesn't have a tool for cutting skinned mesh though.

    Cheers,
    Pärtel
     
  27. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    341
    I’m currently using Final IK and UMA 2.7 and I’m looking to possibly integrate puppet master for mele combat with the player.

    All of my characters share the same skeleton. I have no idea how puppet master works so I’m just throwing this out there.

    Is it possible to have 2-3 puppets in my scene and swap them to NPCs as they get close to player? I’m asking because I pool my characters and just rebuild them on demand as they get killed and I don’t want to each one to have their own puppet when not close to the player.
     
  28. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,891
    Hey,
    Yes, you could set them up with PuppetMaster (current UMA integration is broken due to UMA update, but you can find instructions from this post by another user).

    You can keep the PuppetMaster components in Disabled mode normally, then switch them to Active mode when they get near to the player.

    Best,
    Pärtel
     
    hopeful likes this.