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:
    2,556
    Hey,
    Please expand the Muscles array on the bottom of PM and see what the spine muscle has for "Group" under it's Props.
    Then go to BehaviourPuppet, expand the "Group Overrides" and see if there is an override for that group. Then make sure that override doesn't have "Disable Colliders" enabled.
    That is normally used to keep foot colliders disabled to prevent feet from getting stuck behind ground colliders while running around. Could be that your spine is set to "Foot" group or the override for "Foot" also includes the "Spine" group.

    Asmdefs can be added pretty easily to PM/FIK. Create a new one named "RootMotion" under Plugins/RootMotion. Then create another named "RootMotionEditor" under Plugins/RootMotion/Editor. In the editor one, include only the Editor platform and add RootMotion.asmdef into the References.
    I don't think I can add them into the next version, people would flood me with questions about why their code can't find FIK/PM code anymore.

    Hey,
    It is because of the model's bones are not oriented right. Colliders can't be rotated in Unity so they take the rotation of the gameobject they are attached to. If you select any of those arm bones, you'll see they are not pointing towards the next bone like they should. This can only be fixed in the 3D app that was used to create the model. If you do not have access to that, a workaround would be to add child gameobjects to each ragdoll part and move the colliders over to those. Then you can rotate those children to fix it.

    Hey,
    You should have your character controller stuff on the gameobject that has the Animator (sibling of PuppetMaster, not it's parent). The root of the rig is considered just a folder containing the dual rig so you'd have it in one place. That is because PuppetMaster objects need to be moved by physical forces only, they must not inherit any motion from the character controller.

    Hey,
    PuppetMaster is not a tool for authoring animation. It is a tool for mixing and blending animation with physics.
    That said, there is the Baker tool included, that can be used to record those animation/ragdoll effects as new animation clips.

    If you are looking for a tool to create animation in Unity, I suggest you take a look at UMotion Pro instead.

    Cheers,
    Pärtel
     
  2. MetalDonut

    MetalDonut

    Joined:
    Feb 7, 2016
    Posts:
    127
    So I understand this.... If I only move/rotate the gameobject with the animator on, then my root gameobject that is parent to both the animator and puppet master would never change position. I'd have to move locally to the root position. Is that right? I'm thinking that could provide challenges when trying to rotate etc. as the child will rotate around the parent rather than on it's own axis. Just a little unsure how to best implement this. Thx
     
    Last edited: Apr 7, 2020
  3. thestroyer_

    thestroyer_

    Joined:
    Oct 12, 2015
    Posts:
    10
    Hi!

    I have some issues setting up Puppet Master and Final IK to be working together.

    I have this set up:

    SetUp.png

    The Puppet Master have been configured and then I added a FBBIK to "Character_Male", but when I move the pelvis of the character using the FBBIK, the PuppetMaster remains where the animation is.

    I understand it is due to the internal execution order, but what execution order is the one that fixes the synchronisation between Final IK and PupperMaster?

    The behaviour I expect is that the PuppetMaster follows the Final IK modification, but the PuppetMaster must be allowed to modify the Final IK if a collision has been detected. (Sorry if I haven't expressed myself clearly)

    Thanks in advance :)
     
  4. nobluff67

    nobluff67

    Joined:
    Nov 3, 2016
    Posts:
    338
    Hi,

    I am trying to switch between puppet active mode and disabled (in order to improve performance). I do this through SwitchToActiveMode. I have one issue with this:

    When I switch to active mode, the puppet becomes deformed (e.g. foot pointing in wrong direction). How can I fix this? Or do I maybe enable this mode at a specific time? (e.g. fixed update)

    I am also stuck with how I can determine when a puppet has regained balance. I want to check this as I need to switch the puppet to disabled mode.

    Q1:

    How to I overcome the puppet deformation?

    Q2:

    How to determine if puppet has regained balance>

    Q3:

    Is the above method a recommended way to switch between modes, or do you have another solution?
     
  5. gliealonso

    gliealonso

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

    One of my characters is not reacting to hits with the HitReaction script. I compared the puppet setup with one character that is working, and the only difference I have seen is the Internal Collision in PuppetMaster.

    I will leave some pictures comparing the working character with the defective one.



    PUPPETMASTER

    tiger-puppetmaster.PNG
    fighter-puppetmaster.PNG



    BEHAVIOUR PUPPET
    fighter-behaviourpuppet.PNG tiger-behaviuorpuppet.PNG

    What do you think the issue could be?

    Many thanks,
    Gabriel.
     
  6. JoeyWeidman

    JoeyWeidman

    Joined:
    Dec 30, 2016
    Posts:
    8
    Hello, could this asset be used to create ragdoll physics similar to Human: Fall Flat?
     
  7. alexkarak

    alexkarak

    Joined:
    Feb 7, 2018
    Posts:
    28
    Hey again Partel! I keep running to the same problem over and over again when i try to instantiate a puppet in runtime ..i thought i fixed it but it happened again!
    I want to make the instantiation happen on update!
    This is the script!


    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using RootMotion.Dynamics;
    4.  
    5. namespace RootMotion.Demos
    6. {
    7.  
    8.     // Code example for creating a Puppet in runtime.
    9.     public class CreatePuppetInRuntime : MonoBehaviour
    10.     {
    11.  
    12.         [Tooltip("Character prefab to instantiate (without ragdoll)")]
    13.         [SerializeField]
    14.         public Transform characterPrefab;
    15.  
    16.         [Tooltip("Creating a Puppet from a ragdoll character prefab.")]
    17.         [SerializeField]
    18.         public Transform ragdollPrefab;
    19.  
    20.         [Tooltip("What will the Puppet be named?")]
    21.         [SerializeField]
    22.         public string instanceName = "My Character";
    23.  
    24.         [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.")]
    25.  
    26.         public int characterControllerLayer;
    27.  
    28.         [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.")]
    29.         [SerializeField]
    30.         public int ragdollLayer;
    31.         [SerializeField]
    32.         public Transform Behaviours;
    33.  
    34.  
    35.         void Update()
    36.         {
    37.             if (Input.GetKeyDown(KeyCode.P))
    38.             {
    39.                 Transform target = Instantiate(characterPrefab, transform.position, transform.rotation);
    40.                 target.name = instanceName;
    41.  
    42.                 Transform ragdoll = Instantiate(ragdollPrefab, transform.position, transform.rotation);
    43.  
    44.                 PuppetMaster.SetUp(target, ragdoll, characterControllerLayer, ragdollLayer);
    45.  
    46.                 Transform behaviours = Instantiate(Behaviours);
    47.                 behaviours.transform.SetParent(target.transform);
    48.             }
    49.         }
    50.     }
    51.  

    When i do it on start it all happens smoothly but when i try to do it on update i lose all the behaviours from my instantiated gameobject!
     
  8. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,556
    Hey,
    Yeah, I know its not ideal, but due to technical limitations of Unity, not possible to change. Just forget about the root transform, let it be where it is and do all your translations and rotations on the animator's transform.
    You can also just get rid of the root transform (unparent both animator and PuppetMaster), it will work as long as the animator transform is assigned as "Target Root" in PuppetMaster. In that case, parent the Behaviours to PuppetMaster too.

    Hey,
    Weird, when I add FBBIK to the Dummy in "Basic" demo, play the scene and weigh in the effector, it works. Can you try that and see if it works there? Sorry, not sure how to reproduce the issue right now.

    Hey,
    Sure you have the latest PM? That deformation problem should be fixed in the latest. (You can check version info in Plugins/RootMotion/PuppetMaster/PuppetMaster ReadMe).

    To get a call from BehaviourPuppet when the puppet has regained balance, please find the "On Regain Balance" event on the bottom of BehaviourPuppet and add a UnityEvent to that, that calls a method in your script that calls SwitchToActiveMode().

    Hey,
    Can you also send me your hit reaction code please?
    Did you check the layers of that one character, maybe they are different?

    Hey,
    Sure, can't see why not.
    Basically you'd want to keep the puppet unpinned (set PuppetMaster pin weight to 0), then attach a joint between the hips and a kinematic Rigidbody, that would be your "balance controller". Something like that.

    Hey,
    What did you mean exactly by "lose all the behaviours"? Does the ragdoll fall flat on the ground (without mesh following it) or is BehaviourPuppet not working?
    Maybe you just need to instantiate the behaviours before calling PuppetMaster.SetUp().

    Or if it falls flat on the ground, please try instantiating from LateUpdate instead of Update.
    Instantiating in Update might mean that Animator is updated once before PuppetMaster initiates and that could cause it to fail.

    Cheers,
    Pärtel
     
  9. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Partel,

    In v 0.9 Sept. 9th, 2019 release of PuppetMaster you have the following release note and added code in BehaviourPuppetDamage.cs:
    - Disabled damage from the ground layers while in the getup state and also disabled damage from ground layers to the foot muscles.
    Code (CSharp):
    1.  if (LayerMaskExtensions.Contains(groundLayers, m.collision.gameObject.layer)) {
    2.                 if (state == State.GetUp) return; // Do not damage if contact with ground layers and in getup state
    3.                 if (puppetMaster.muscles[m.muscleIndex].props.group == Muscle.Group.Foot) return; // Do not damage if feet in contact with ground layers
    4.             }
    What was the reason for preventing feet from colliding with all ground layers regardless of collision layers?

    The problem with this change is there are times when I want the feet to register collisions from ground layers. For example, when my character is running across Ice, he slips and falls. Ice is both a ground layer and a collision layer. I then use Collision Resistance Multipliers with the Ice layer to determine the frequency of unpinning.

    If there is a good reason (like performance?), I can probably come up with a different way to unpin when the character runs across an ice layer. I could use the controller capsule collider/rigibody to detect collision with ice layers and send an event to cause unpinning. Of course I can just comment out those lines but then every time you have an update, I have to remember to comment them out again.

    Thanks
    Allan
     
  10. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    509
    How can set a delay time between falls and trying to get up?
     
  11. nobluff67

    nobluff67

    Joined:
    Nov 3, 2016
    Posts:
    338
    There is a "Get Up Delay" inspector variable in the "behaviourpuppet" script (under gameobjects behaviours/puppet.
     
    Crossway likes this.
  12. JoeyWeidman

    JoeyWeidman

    Joined:
    Dec 30, 2016
    Posts:
    8
    Hello,
    I want to use the Biped Ragdoll Creator, but because my character has no arms or feet, I cant fill in all the bone references. Is there a way to automatically create a humanoid ragdoll without hand or foot bones?
     
  13. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    509
    Is there any difference if I set my character animator update mode to Normal or Unscaled Time instead of Animate Physic? because I have a bug with my character when I set to Animate Physic.
     
  14. AhJun

    AhJun

    Joined:
    Dec 30, 2019
    Posts:
    14
    I keep reading this warning but I still don't understand how to get rid of it right before clicking on "Set up puppetmaster button":

    NB! 'Animated Target' is set to the same GameObject as this. PuppetMaster will make a duplicate of this GameObject and break the prefab and remove ragdoll components. It is recommended to set up the ragdoll on a new model instance, add Puppetmaster to that and assign the original character as its 'Animated Target'.

    I only have the mesh and root/hip transforms so I'm not sure what else i need to remove to remove this warning.

    thanks!
     
  15. MetalDonut

    MetalDonut

    Joined:
    Feb 7, 2016
    Posts:
    127
    Thanks you sir! I took your latter solution of unparenting the animator and puppetmaster when I activate the ragdoll and this seems to work well.

    Strange question - but is there a reason why my puppetmaster feet colliders get disabled on awake? None of the other limbs do this and the feet don't do this in your examples, so I'm thinking it must be one of my scripts - but can't find it. I was wondering if there is a setting or something in puppet master I've maybe changed to make this happen?? Thx
     
  16. nobluff67

    nobluff67

    Joined:
    Nov 3, 2016
    Posts:
    338
    Hi Pärtel,

    The RayCastShooter demo has two variables that relate to the puppet being knocked down. The force is self explanatory however I am not sure if the unpin variable relates to a specific field within the puppet setup, can you elaborate on this variable?

    e.g.
    1. Does it combine with the overall rigidbody mass of the puppet?
    2. Or does it combine with the rigidbody mass of the puppet part (e.g. foot)?
    3. Pin Weight (0-1), how does this apply to the effect?
    I am trying to calculate how much "unpin" I need, at the moment I am using trial and error, which is not very effective.
     
  17. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Partel,

    I've decided to avoid using PuppetMaster/Ragdoll collisions as much as possible. Specifically the OnCollisionImpulse event that uses the BehaviorPuppetDamage.cs class and the OnMuscleCollisionBehavior method in that class.

    The problem is it is far too difficult and inconsistent to debug what causes a character to become unpinned or unbalanced.

    Determining why, how or the cause for a character to become unbalanced amounts to hours and hours of trial and error, changing tons of settings in PuppetMaster.cs and BehaviuorPuppet.cs and waiting to see what happens. Most of the code in BehaviourPuppetDamage.cs is undocumented and doesn't make sense especially the GetImpulse() method that ultimately determines unbalancing.

    If there was some sort of debugging option that allowed the user to trace what causes unbalancing/unpinning, perhaps PuppetMaster would be more useful.

    Thanks
    Allan
     
  18. sherzhen

    sherzhen

    Joined:
    Jun 28, 2015
    Posts:
    13
    Hey, I hope you are doing well in this difficult time!

    Firstly, thank you so much for such a truly cool tool :)

    Secondly, I really was looking for an answer on the forum, but I couldn’t find it, sorry, if I still missed it somewhere ...

    And thirdly - sorry for my googlEnglish.

    I want my character to be able to get up on a moving platform. I am using PuppetBehaviour. The variable maxGetUpVelocity takes into account the speed of the body even if the body lies on this platform. Using raycast, I tracked the platform on which the body lies and if it has a rigidbody with speed, then this speed is subtracted from the speed of the body and character stands up. Unfortunately, the character stands in one place, and the platform below him continues to move, how can this be fixed?

    Thanks!
     

    Attached Files:

  19. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,556
    Right, good catch!
    You could plug in to BehaviourPuppet.OnCollision delegate:

    Code (CSharp):
    1. void Start() {
    2. behaviourPuppet.OnCollision += OnCollision;
    3. }
    4.  
    5. private void OnCollision(MuscleCollision m) {
    6. if (m.collision.collider.layer == iceLayer) behaviourPuppet.UnPin(m.muscleIndex, m.collision.impulse.sqrMagnitude * iceDamage);
    7. }
    For that to work, please go to BehaviourPuppetDamage.cs line 106 and make the method public. I'll add that change into the next version too.

    Hey,
    Under BehaviourPuppet's "Getting Up" header there is Get Up Delay.

    No, sorry. You could add empty dummy gameobjects as hand feet, destroy them later.

    Hey,
    In Normal mode PuppetMaster lags a frame behind of the animation because animation is updated after physics. That is all. What is the bug with AnimatePhysics?

    Hey,
    It is just a FYI. It means if you have PuppetMaster's own transform assigned as Target Root, it will have to duplicate itself and destroy every component on the character not required by PuppetMaster. Might result in missing references in your other components. It is fine if you are building a puppet from scratch, but if you already have things like character controllers and navmeshagents and what not set up, the recommended way of settings up puppets is this:

    1. Drag in a new instance of the character model from the assets
    2. Set up ragdoll on that new instance
    3. Add PuppetMaster to it
    4. Assign the original character (the one with the character controllers and stuff) as "Target Root" in PuppetMaster.
    5. Check Ragdoll and Character Controller layers
    6. Click on Set Up PuppetMaster.

    That way PM won't have to duplicate or destroy anything and all your references/dependencies remain intact.

    In BehaviourPuppet, under "Muscle Group Properties" header you have Group Overrides. Find the override for the Foot group and it probably has "Disable Colliders" enabled. That is used just to prevent feet getting stuck behind ground colliders. Foot colliders will be enabled only when the puppet is unpinned then.

    Hey,
    It is the equivalent of collision.impulse.sqrMagnitude if the damage originated from collision.
    But the amount that you need depends on your Collision Resistance values.
    It does combine with rigidbody mass, unpin is divided by mass so that you could use the same value for all regardless of ragdoll mass.
    Unpin is applied to muscle.state.pinWeightMlp. The total pin weight used by the muscle is puppetMaster.pinWeight * muscle.props.pinWeight * muscle.state.pinWeightMlp. state.pinWeightMlp is an internal value hidden in the Editor because it is supposed to be used exclusively by the puppet behaviours.

    Hey,
    The only thing that ever causes the puppet to unbalance is a muscle drifting too far (Knock Out Distance) from it's target. That happens in BehaviourPuppet.cs line 656.

    All the GetImpulse stuff just handles loosening pin weights on collision. If you find all that too confusing (sorry!) and would prefer to write your own solution for damage that you'd understand 100%, you could comment out the code in protected override void OnMuscleCollisionBehaviour(MuscleCollision m) in BehaviourPuppetDamage.cs and replace it with code that just reduces .state.pinWeightMlp for the muscle (and adjacent muscles) that were hit (MuscleCollsion.muscleIndex is the index of the muscle that collided).

    Hey,
    Can you check please if setting "Blend To Animation Time" and/or "Min Get Up Duration" to 0 makes the puppet not get stuck? Then I'd know where to find the issue.

    Cheers,
    Pärtel
     
    nobluff67 likes this.
  20. sherzhen

    sherzhen

    Joined:
    Jun 28, 2015
    Posts:
    13
    Thank you very much for the tip, Pärtel, everything works fine :)
     
  21. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    509
    Thanks. What about Collision Detection on rigidbody? Can I set to Continuous Dynamic? Because I get better performance with Continuous Dynamic than discrete mode.
     
  22. gliealonso

    gliealonso

    Joined:
    Oct 21, 2018
    Posts:
    117

    Hi Partel,

    (I MANAGED TO FIX THE HITREACTION ISSUE, THE PROBLEM WAS IN THE FBIK)

    I'm also having issues with how some of the characters are getting up, they look like those inflatable dolls you see at gas stations when they are getting up sometimes hahaha

    upload_2020-4-15_14-47-57.png

    And also when I hit one of the characters, sometimes the head jiggles really fast, just like if you flicker those dolls that you leave on your car.
    upload_2020-4-15_19-0-26.png
    (The examples are so dumb, but at least you get the idea xD )

    Do you know what could be the issue?

    Many thanks,
    Gabriel.
     
    Last edited: Apr 15, 2020
  23. MetalDonut

    MetalDonut

    Joined:
    Feb 7, 2016
    Posts:
    127
    Nailed it! THANK YOU!!
     
  24. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,556
    Hey,
    Sure, can use CD, no problem.

    Hey,
    I've never seen a puppet do any wacky arm waving when getting up, can you record a video or send me a repro or something please? The dog jiggle issue must be related to that. Maybe you don't have enough Muscle Spring, also try increasing Muscle Damper in PuppetMaster.

    Best,
    Pärtel
     
  25. MetalDonut

    MetalDonut

    Joined:
    Feb 7, 2016
    Posts:
    127
    Any reason why the foot colliders would go through the floor when the puppet is first initiated through .KIll()? The colliders are enabled and not set to trigger but they are going through the floor for about the first second and then start colliding properly after that. Is there a setting I should be looking into in order to fix this?
     
  26. gliealonso

    gliealonso

    Joined:
    Oct 21, 2018
    Posts:
    117

    Hi Partel,

    It's not that

    Hi Partel,

    This is how the character sometimes gets up,

    https://imgur.com/a/gkweILS

    Regarding the head bobbing, I'm gonna play a bit with the muscle damper,

    Thanks Partel!
    Gabriel.
     
  27. alexkarak

    alexkarak

    Joined:
    Feb 7, 2018
    Posts:
    28
    Hey Partel
    So i am running into this problem...
    i want to apply damage on an enemy with oncollisionimpulse but the impulse is happening both on my character and my enemy resulting into taking damage whenever i try to hit the enemy...

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using RootMotion.Dynamics;
    4. using System;
    5.  
    6. public class PLAYER : MonoBehaviour
    7. {
    8.     public HealthBar healthbar;
    9.     public float life = 1000;
    10.     public BehaviourPuppet puppet;
    11.    
    12.     void Start()
    13.     {
    14.         //puppet = this.gameObject.GetComponent<BehaviourPuppet>();
    15.         puppet.OnCollisionImpulse += OnCollisionImpulse;
    16.         healthbar.SetMaxHealth(life);
    17.  
    18.  
    19.     }
    20.     private void OnCollisionImpulse(MuscleCollision m, float impulse)
    21.     {
    22.        
    23.         if (m.collision.collider.gameObject.layer == 9)
    24.         {
    25.             life -= impulse / 10;
    26.             healthbar.SetHealth(life);
    27.  
    28.         }
    29.  
    30.         if (life <= 0f)
    31.  
    32.         {
    33.          
    34.             puppet.puppetMaster.Kill();
    35.         }
    36.     }
    37. }

    i want to apply damage to the enemy only when my player hits and the reverse for my player(when the enemy hits) !

    2. Also i am trying to add some variations to my characters attacks! i am using character
    meele demo....but when i try to add more animations it fails horribly..
     
    Last edited: Apr 20, 2020
  28. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,556
    Hey,
    Thanks for the video, I couldn't spot anything right away, but can you please also send a screenshot of your PuppetMaster component and the Getting Up section of BehaviourPuppet?

    Hey,
    You should use the Boosters. Deckare a public Booster booster; fill it out in the editor and call booster.Boost(behaviourPuppet) when the attack starts to give temporary immunity and/or impulse multiplier to the attacker. The melee demo already uses boosters here:
    Booster.JPG

    That booster gives 0.5 immunity to the prop muscle and it's parents and also makes it apply 5 times more damage to the puppet it hits (impulseMlp). Boosting effect falls off over time, defined by "Boost Falloff" in BehaviourPuppet. Value of 1 means the effect will be gone in 1 second.

    That melee demo character controller was designed just for demo purposes, not really meant as a universal character controller to be easily extended. But to add more actions, you'd have to extend the Actions list (same place as the screenshot) to add in a new action. The first action (Swing Prop) plays the animation on the base layer while standing and upper body layer while running around. Go to the "Actions" sub-state machine in the Animator and add in a new animation just like you see the SwingProp and Hit actions. If you want to make it independent of locomotion, also add in the animation state to the UpperBody Actions layer (1).
    Finally, go to UserControlMelee.cs and change the script to set state.actionIndex based on which key you wanna use to start the action. state.actionIndex corresponds to "Input Action Index" in the actions list. So 0 is no action, 1 is either SwingProp or Hit based on if you have a prop or not. Your new action should use 2. In the Actions sub-state machine, make sure you have a transition to your new animation with the ActionIndex parameter set to 2. Note that ActionIndex parameter in the Animator corresponds to the index of the action in the Actions list, not Input Action Index.

    Best,
    Pärtel
    The second action (Hit) plays only when standing.
     
  29. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,556
  30. gliealonso

    gliealonso

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

    Here is the PuppetMaster component:
    upload_2020-4-21_22-37-55.png
    upload_2020-4-21_22-39-42.png

    And the Behaviour Puppet
    upload_2020-4-21_22-40-27.png

    Thanks for the help, bro!
    Gabriel.
     
  31. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,556
    Hey,
    Have you tried with lower Blend To Animation Time in BehaviourPuppet?

    What that does is create a transition from last ragdoll pose to the getting up animation, so it would be smooth. But that getting up animation seems to be so quick, 0.4 is probably the entire duration of it.

    What seems to happen in your video, it tries to get up once, fails, then tries again, but the animation is so fast, it is still blending from ragdoll pose, so you get this kind of half transition-half animation result.

    You might wanna try increasing Muscle Damper to reduce the rubber chicken effect. I usually use 10% of Muscle Spring for damper, so if you have 100 spring, set damper to 10.

    Best,
    Pärtel
     
  32. RuslanVI

    RuslanVI

    Joined:
    Oct 18, 2019
    Posts:
    3
    Hi! PuppetMaster can not create box colliders. Only sphere or capsule
     

    Attached Files:

  33. gliealonso

    gliealonso

    Joined:
    Oct 21, 2018
    Posts:
    117

    I think it worked! Thanks a lot, bro!

    Gabriel.
     
  34. alexkarak

    alexkarak

    Joined:
    Feb 7, 2018
    Posts:
    28
    Hey Partel... I changed my character model from the replace character model option in character melee demo and suddenly the grab script ( the one that allows my puppet to pickup other puppets stopped working) any idea why? Also I want to add a bool to check if we are attacking so that on collision impulse damage to be applied only when my character hits (when action index =1) but I don't know where to put it..
     
  35. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,556
    Hey,
    When I drag that same teddy into the scene, just add BipedRagdollCreator and click Create, it works. Can you give me any specific steps I could take to reproduce this?

    Was that grab script using PropMuscles? Because that replacement tool can not replace prop muscles, they will have to be recreated manually (Add Prop Muscle button on the bottom of PuppetMaster).

    About that collision impulse damage thing, it should go to CharacterMeleeDemo.cs inside the brackets of if (StartAction(actions)), check if (i == 1), then I guess you ought to find any enemy puppets nearby and change their BehaviourPuppet's collisionResistance to what you normally use, reset it to Mathf.infinity after a second or so.

    Best,
    Pärtel
     
  36. alexkarak

    alexkarak

    Joined:
    Feb 7, 2018
    Posts:
    28
    I tried searching for the enemys with an overlap sphere around my character but it doesnt work...or i am doing something wrong :p
    I am struggling all morning to make it work! :/
     
  37. Kagyu

    Kagyu

    Joined:
    Mar 5, 2016
    Posts:
    96
    Hi Partel,
    I need to add shoulder joints to my PM ragdoll. What do I need to do for PM working with additional joints like shoulders?
    I did a small experiment on this subject and saw continuous jittering around shoulders but I could not find what was the cause of the jittering.
     
  38. gliealonso

    gliealonso

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

    I'm having some issues now with the characters not being able to get up, they look like turned over turtles. When I left the blend animation at 0.1 or 0.05, it stopped making the characters from getting up looking like flacid vampires, but now I'm having issues that they have a lot of difficult getting up sometimes.

    Could you please check it out?

    PuppetMaster
    puppet master.PNG

    Behaviour Puppet
    puppet get up.PNG


    Edit: Also, is there a way to make the characters more solid after they lose balance? Sometimes their legs or arms go to very unnatural positions.

    Many thanks!
    Gabriel.
     
    Last edited: May 1, 2020
  39. sancha-km

    sancha-km

    Joined:
    Jun 5, 2016
    Posts:
    41
    Hi,
    Any info about setup of Puppet Master and A star Pathfinding?
    All is working fine with standart Unity navmesh and agent.
    But on A star Pathfinding puppet very often fall during moving and fall again many times after get up.
    I exclude ground from collision matrix, set max collision resistance and treshold.
    Set also unpin for foot\legs to zero in puppet behaviour.
     
    Last edited: May 1, 2020
  40. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,556
    Hey,
    If you have a script that contains a list of all characters, you could check for sqrMagnitude from the attacker instead of overlap sphere.

    Hey,
    If you see jittering, that is usually because of either joint limits or internal collisions not allowing enough range of motion for the ragdoll to follow the animation. Please try disabling either "Angular Limits" and/or "Internal Collisions" in PuppetMaster to see which one it is, then either loosen the limits with RagdollEditor or make the colliders smaller.

    Hey,
    You'll have to increase "Get Up Knock Out Distance Mlp" even more. About making unpinned ragdolls more solid, increase "Unpinned Muscle Weight Mlp" and if it is already 1, increase "Muscle Spring" in PuppetMaster.

    Hey,
    It should not make a difference to PM if you are using A* instead of NavMeshAgent. Only thing I can think of, maybe A* keeps your puppet closer to ground by having different nav mesh height offset.

    Please see that your ground collider layers are included in BehaviourPuppet's "Ground Layers".

    Cheers,
    Pärtel
     
  41. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    704
    Hi, Partel,
    I have a question when a puppet lost balance.
    The puppet can lose its balance in Supine position and I need to turn it over to Prone smoothly.
    A use case is that when the puppet cannot get up for a while, I would like it to start crawling.
    Crawling only makes sense in Prone position but I can't seem to flip the ragdoll over from Supine.
    Do you have some ideas how it can be done?

    Thank you very much.
     
  42. bigdaddio

    bigdaddio

    Joined:
    May 18, 2009
    Posts:
    220
    What happened to your forums? When I go to check the forums I get a support page that will not allow me to sign up for a forum account.
     
  43. sancha-km

    sancha-km

    Joined:
    Jun 5, 2016
    Posts:
    41
    Hi,
    What is needed for puppets to collide with each other? I try this:
    1. Check puppet layer in physics
    2. Enable internal collisions(both)
    3. Set pupper layer in Behaviours puppet collision layers with very low collision resistance
    4. Also you send prevously script to get colission info(attached also full script), when puppets collide, it return no info.
    If puppet collide with standart object, with same layer as puppet, it works:


    public BehaviourPuppet puppet;

    public Vector3 lastCollisionImpulse;

    private void Start()
    {
    puppet.OnCollision += OnMuscleCollision;
    }

    private void OnMuscleCollision(MuscleCollision m)
    {
    lastCollisionImpulse = m.collision.impulse;
    }
     

    Attached Files:

  44. kukulagames

    kukulagames

    Joined:
    Dec 16, 2019
    Posts:
    3
    Hello everyone. I've mailed Partel about my problem already, but Id like to see if maybe some of you know about this and add more details about the problem for you Partel.
    I am trying to add puppetmaster to an opsive thirdperson character and I am getting some errors. I have fixed few of them, but here are the ones I need help with:


    The position of each muscle needs to match with the position of it's target. Muscle 'Hips' position does not match with it's target. Right-click on the PuppetMaster component's header and select 'Fix Muscle Positions' from the context menu.
    UnityEngine.Debug:LogError(Object, Object)
    RootMotion.Dynamics.PuppetMaster:IsValid(Boolean) (at Assets/Plugins/RootMotion/PuppetMaster/Scripts/PuppetMasterValidation.cs:77)
    RootMotion.Dynamics.PuppetMaster:Initiate() (at Assets/Plugins/RootMotion/PuppetMaster/Scripts/PuppetMaster.cs:614)
    RootMotion.Dynamics.PuppetMaster:Awake() (at Assets/Plugins/RootMotion/PuppetMaster/Scripts/PuppetMaster.cs:564)


    NullReferenceException: Object reference not set to an instance of an object
    RootMotion.Dynamics.PuppetMaster.FixedUpdate () (at Assets/Plugins/RootMotion/PuppetMaster/Scripts/PuppetMaster.cs:948)

    NullReferenceException: Object reference not set to an instance of an object
    RootMotion.Dynamics.PuppetMaster.Update () (at Assets/Plugins/RootMotion/PuppetMaster/Scripts/PuppetMaster.cs:1049)

    NullReferenceException: Object reference not set to an instance of an object
    RootMotion.Dynamics.PuppetMaster.LateUpdate () (at Assets/Plugins/RootMotion/PuppetMaster/Scripts/PuppetMaster.cs:1069)

    and then it keeps repeating the last three errors as its in update. I did watch the youtube video that explains how to integrate puppet master with opsive char but it is outdated. I did most of the things you have to do with any integration, like copy the behaviors and behavior animations.
     
  45. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,556
    Hey,
    The easiest would be to use the "Crawl Backwards" animation from Mixamo when in supine.
    To turn the ragdoll around, might try to play an animation like "Prone Roll" in Mixamo. The ragdoll physics might or might not achieve getting the puppet turned. Might need to add some torque to the hip rigidbody to assist, check out public static void AddFromToTorque(Rigidbody r, Quaternion toR, ForceMode forceMode) and public static void AddFromToTorque(Rigidbody r, Vector3 fromV, Vector3 toV, ForceMode forceMode) in RootMotion.PhysXTools, they could be used to add torque to the pelvis to help flip it.

    For some reason it happens to some people, can you please send me a screenshot of the page you are seeing so I could ping Freshdesk support about it?

    Hey,
    Did you check the Layer Collision Matrix in play mode? You might have that LayerSetup component (I use it in the puppet demos to set up the matrix at Start) somewhere in the scene and that changes it.

    Hey,
    Opsive TPC is currently not supported, sorry, the integration broke when they updated to 2.0 and I have not been able to fix it so far. If you have no other use for PM I can get it refunded for you if you send me your invoice number.

    Best,
    Pärtel
     
  46. sancha-km

    sancha-km

    Joined:
    Jun 5, 2016
    Posts:
    41
    Check it, Layer Collision Matrix not changing in play mode.

    Update. Collision between puppets not working if i place them in pool on start, as child to an gameobject.
    If storing in gameobject array, all is working fine.
    Any fix to this? Because i may need to add puppet as child to gameobject in future.
     
    Last edited: May 9, 2020
  47. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    704
    Thanks, Partel as always. I'll give it a try. ^^
     
  48. gliealonso

    gliealonso

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

    I'm still having issues with the getting up for the Puppets, I'm not sure if it's because the FBIK is getting out of the PlayArea, because there are walls where the edges of the PlayArea is, and that's causing the issues.

    Here is a gif of the issue:
    https://imgur.com/a/fPESD1f
    (It only happens sometimes)

    I even tried to set the Blend To Animation Time to 0.0001, and still the issue happens.

    puppet master.PNG puppet get up.PNG

    EDIT: Could it be related to this?
    puppeterrors.PNG


    What do you suggest I try?

    Many thanks,
    Gabriel.
     
    Last edited: May 11, 2020
  49. mutp

    mutp

    Joined:
    Oct 1, 2018
    Posts:
    79
  50. FriendNFoe

    FriendNFoe

    Joined:
    Sep 24, 2012
    Posts:
    11
    Hey Partel, awesome work on this plugin, really having a blast playing around with it :)

    I'm using UCC though, and encountering errors when combining with Puppetmaster, even just initializing things, would be great to have a basic integration in place!