Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

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,656
    Hey,
    Not sure if I understood... Is the problem with the puppets not being able to get up and losing balance repeatedly because of colliding with other puppets? In that case you should increase the "Get Up Collision Resistance", "Get Up Regain Pin Speed Mlp" and "Get Up Knock Out Distance" under BehaviourPuppet.
     
  2. somosky

    somosky

    Joined:
    Feb 15, 2014
    Posts:
    80
    Hi. So I'm going to try to explain this correctly but I'm not exactly sure how to explain it. I'm currently using Puppet Master with Unitys AI agents. About 90% of the time everything works perfectly. However about 10% of the time the Rag doll and the AI agent get "detached" from each other where let's say the Rag doll runs into a wall and the AI Nav Agent continues through the wall. Now I'm aware this particular issue can be fixed with rebaking the Nav Mesh to include this wall but this also happens at other random times.

    So my question is is there a simple way to say if the rag doll is too far away from the animated character to teleport the rag doll to the position of the animated character? Almost like a fix if one it too far away from the other?
     
  3. beowulfkaine

    beowulfkaine

    Joined:
    Apr 3, 2014
    Posts:
    125
    I'm looking at the demo scene called Melee Spherical in PM and it says to grab the prop and hit the bears with E. When I do this, the prop just goes through the bear and soldier. Am I missing something?
     
  4. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,656
    Hey, sorry for the delay.

    You'll have to disable the nav agent while behaviourPuppet.state != BehaviourPuppet.State.Pinned, it should not be moved or rotated at this time. When the puppet gets up, BehaviourPuppet will automatically move the character to the position of the ragdoll.

    Hey,
    This can happen if you import PuppetMaster to a project where you have changed the Layer Collision Matrix. Try importing to a new project.

    Cheers,
    Pärtel
     
  5. somosky

    somosky

    Joined:
    Feb 15, 2014
    Posts:
    80
    I noticed under the Puppet behaviors there's a way to send a message when the Puppet looses balance etc. Would that be a good place to do that or is there a way from the Puppet master script to send a message when Pinned is false? Or would I need to code that myself?

     
  6. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,656
    Hey,
    Yeah, that's what those events are for.
    If you need to do something continuously while unpinned, you could maintain a reference to the BehaviourPuppet component
    Code (CSharp):
    1. public BehaviourPuppet puppet;
    and check it's state:
    Code (CSharp):
    1. if (puppet.state != BehaviourPuppet.State.Pinned) {
    2. // Do something while the puppet is unpinned or getting up.
    3. // Just don't move/rotate the character controller, BehaviourPuppet should have exclusive control over that during Unpinned/GetUp states.
    4. }
     
    dyupa likes this.
  7. cspid

    cspid

    Joined:
    Apr 25, 2014
    Posts:
    11
    Hi Partel,
    I'm having an issue where on behaviour fall, the target pose moves down beneath the player and the ground, and when he tries to get up it drags the character through the ground and offscreen. Before the character loses balance it can walk around normally. Any suggestions?

    Thanks Screen Shot 2018-03-23 at 2.49.57 AM.png Screen Shot 2018-03-23 at 2.55.39 AM.png
     
  8. m4ng4

    m4ng4

    Joined:
    Apr 17, 2013
    Posts:
    4
    Hi,

    Verry nice tool here, havent tested it much.
    so just a question is there a tutorial for how to make this possible? or could anyone point me in the right direction?
    My character dosent have any legs just the upper boddy and puppetmaster wont let me create the puppet becouse the legs are missing.

    Br,
    Daniel
     
  9. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,656
    Hey,
    Are you sure you have the layer of that ground collider included in BehaviourFall's "Raycast Layers"?

    Hey,
    Did you mean you are unable to create the ragdoll without legs using the BipedRagdollCreator?

    You could add empty gameobjects as "legs", create the ragdoll, then just delete them.

    Best,
    Pärtel
     
  10. m4ng4

    m4ng4

    Joined:
    Apr 17, 2013
    Posts:
    4
    Was thinking on trying that out right now..
    So simple!

    Thanks!
     
  11. cspid

    cspid

    Joined:
    Apr 25, 2014
    Posts:
    11
    Yes, Behaviour Fall's raycast layer is set to the ground layer but the problem remains
     
  12. Morseliot

    Morseliot

    Joined:
    Jan 10, 2015
    Posts:
    17
    Hello Partel,
    I'm working on multiplayer game using your solution (great tool by the way). Managed to sync falls, but can't find the way how to sync get up operation, could you please advice which direction I should move? Probably I need to call UNet function in unity event section of Behaviour Fall "On End", but how do I determine which side the player should play animation or is there something already pre-setup that I might use?
    Alex
     
  13. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,656
    Hey,
    Do you have any code that changes the character position while BehaviourFall is enabled?
    If that's not it, any chance you could send me a repro project or something so I could take a closer look?

    Hey,
    It would be best if state switching was controlled by the owner of each puppet. So you set Collision Resistance to Mathf.Infinity for the remote puppets and RPC a behaviourPuppet.SetState(BehaviourPuppet.State.Unpinned) from the owner to all others when it falls over. In a similar way, set BehaviourFall.canEnd to false for the remote puppets, and RPC to enable it when BehaviourFall invokes the "On End" event on the owner's side.

    Best,
    Pärtel
     
  14. Junk1212

    Junk1212

    Joined:
    Mar 27, 2018
    Posts:
    2
    Hello!
    I'm using puppet master to realize a 3d platform. The character is set just like the soldier in your demo (with Capsule Collider). The player needs to jump on slightly inclined platforms. When the jump is performed the character does not put his feet on the platform because of the capsule. Have you some suggestions for me? Maybe the capsule solution is right for a walking character, but not for a jumping one.

    Thanks in advance.
     
  15. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,656
    Hey,
    Looks like you need some IK foot placement correction. That video shows the Grounder that is a part of my other asset, Final IK. There are other cheaper products for foot placement on the Store too if that's all you would ever need IK for, but I can't guarantee they will work seamlessly with PuppetMaster.
     
  16. Junk1212

    Junk1212

    Joined:
    Mar 27, 2018
    Posts:
    2
    Thanks for the answer. I will use Final IK.
    I still need a capsule collider to keep the character standing?

    Thank you
     
  17. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,656
    You'll still need the capsule collider to keep the character from falling through the platforms, yes. The Grounder only works on the bone level as a cosmetic layer on top of the animation.
     
  18. yuyorke

    yuyorke

    Joined:
    Nov 4, 2016
    Posts:
    2
    Hello,
    I'm enjoying Puppet Master and Final IK, they are amazing tools.
    By the way I need my character to take a bar/stick, something like the ninja turtle in the picture.
    So two hands, to points.



    Of course the hands should properly move the bar, they are already animated.

    Is this possible with the Puppet Master Props?
    Or should I use the Interaction System?
    Or a combination of both?

    Thank you
     
    Last edited: Apr 4, 2018
  19. Useless-Media

    Useless-Media

    Joined:
    Apr 19, 2015
    Posts:
    101
    Hello Partel,

    What is the best way to simulate a Bullet Impact or a explosion of a Granate on the Character Body?

    I have now a little setup with Puppet Master and Final IK, when i have a explosion i clear up the radius and including the bones which need to be changed, then i spawn for each bone which is effected a dummy GameObject with a Rigidbody on it, i add explosion force to this dummy GameObjects and let do Final IK the work with the FullBodyBipedIK by let the IK follow the effected dummy GameObjects.
    GranadeTest.gif

    But this is all a little glitch, most of the time it looks strange and unrealistic.

    Can i make something with puppet master or behaviour puppet maybe a offset you can add to the muscles or is there a function which helps me to make a good explosion?

    EDIT: I searched a little in the Forum and found Broadcaster.Hit() i think its possible with a little math calculating the force and the position but before i start and do something wrong let me know if there is already a build in way i can walk with my explosions

    EDIT AGAIN: Its working now with MuscleCollisionBroadcaster.Hit(float unPin, Vector3 force, Vector3 position) but can you tell me how i calculate the unPin variable based on the Force?
     
    Last edited: Apr 5, 2018
  20. Useless-Media

    Useless-Media

    Joined:
    Apr 19, 2015
    Posts:
    101
    Partel,

    I changed the Muscle Hit behaviour to:
    Code (csharp):
    1.  
    2. public void Hit(float unPin, Vector3 force, Vector3 position, bool isTraining) {
    3.             if (!enabled) return;
    4.             foreach (BehaviourBase behaviour in puppetMaster.behaviours) {
    5.                 behaviour.OnMuscleHit(new MuscleHit(muscleIndex, unPin, force, position, isTraining));
    6.             }
    7.         }
    8.  
    Added the isTraining bool
    With this change i have the option to use weapons which makes no damage but still effecting the Body, then i can make something like:
    Code (csharp):
    1.  
    2. void OnMuscleHit( MuscleHit hit ) {
    3.             if ( !hit.m_IsTraningsHit )
    4.             {
    5.                 Health -= CalculateDamage( hit.muscleIndex, hit.unPin * 0.5f );
    6.             }
    7.         }
    8.  
     
    Last edited: Apr 5, 2018
  21. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,656
    Hey, sorry for the delay, I was on a short vacation.
    Do you have animations to use that bar/stick?. It would probably be easier to use a traditional animation, using the InteractionSystem together with all that PuppetMaster Prop stuff would probably make everything very complicated.
    You can use the Prop system for 2-handed props though, you'll just to connect the other hand to the prop with a joint too.

    Hey,
    The unpin value can't really be calculated, it should be empirically found by testing out smaller and larger values and seeing what works best.
     
  22. Anusain_Mv

    Anusain_Mv

    Joined:
    Jan 6, 2017
    Posts:
    4
    Hello @Partel-Lang ,
    i am using puppet master for the enemy in VR game and till now everything is working fine.
    when i am grabbing the enemy in VR with my hand and its working but their are some issues like i have put angular limit when my enemy is at dead state but in VR when i am shaking the enemy its breaking the limits and how i can make the enemy more stiff in dead state.
    i want to do just like in robo recall we do when we grab the enemy and shake it.
     
    Last edited: Apr 9, 2018
  23. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,656
    Hey,
    If the limits are breaking, it means PhysX just can't handle the forces applied to the joints (joints in Unity are especially bad since Unity 5). You should increase "Solver Iteration Count" for the shaking puppet.

    You can make the enemy more stiff in dead state by increasing "Dead Muscle Weight" under PuppetMaster's "State Settings".
     
  24. h00man

    h00man

    Joined:
    Apr 17, 2017
    Posts:
    23
    hey partel,
    i'm using a simple script for shooting bullets with raycast.
    i was wondering how can i tell the puppet to be effected by the raycast bullets?
    something like a ball shooter script which is attached to camera in the puppet extended scene ,but this time instead of ball game objects i need the puppet to be unpinned by raycast.does puppet master only respond to game objects in certain layers?
     
  25. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,656
    Hey, please take a look at the "Puppet Raycast Hit" demo and the script used in that is RaycastShooter.cs.
     
  26. unity_kony_X_JrICrmQ

    unity_kony_X_JrICrmQ

    Joined:
    Apr 18, 2018
    Posts:
    2
    Hi Partel, are there any plans on inVector Integration.
    it works to some extend with Basic Locomotion template but things like the crouch animation, and Roll are not working probably.
    When Crouching for instance the character is just sliding around and not playing The Moving While Crouching animation unless u disable the puppetmaster component or make the puppet kinematic or disabled.
     
    Last edited: Apr 18, 2018
  27. Weendie-Games

    Weendie-Games

    Joined:
    Feb 17, 2015
    Posts:
    45
    Hi @Partel-Lang , i know my issue is not directly related to PuppetMaster (is related to the A pose, but on T pose i get other issues with my custom clothing system), but i'm getting wrong colliders rotation attached to the ragdoll joints.

    It is possible to rotate the colliders after the creation with the Ragdoll Editor?
    upload_2018-4-18_11-2-32.png

    Something like this:
     
    Last edited: Apr 18, 2018
  28. Useless-Media

    Useless-Media

    Joined:
    Apr 19, 2015
    Posts:
    101
    Hey, Patel

    I need your help again, i have set up some Dummies with Puppet Master and Behaviour Puppet.

    It looks like the Player is always Stronger then the dummy
    PlayerStronger.gif

    How can i have the same Resistance on both characters?
     
  29. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,656
    Hey,
    There is an integration package to Invector's third person controller under PuppetMaster/_Integration. I haven't checked if it still works with their latest in a while though.

    Hey,
    That is a broken character, the bone orientations should really be fixed in the 3D app it was created in. In Unity it is not possible to rotate colliders directly, so in that video it probably moves the colliders to child gameobjects to rotate them instead and use the colliders as Compound Colliders, but that can't be done with the RagdollEditor at the moment.

    Hey,
    Did you try using the same value "Collision Resistance" value in BehaviourPuppet?
    It is also possible that the stronger puppet doesn't have the weaker puppet's ragdoll layer included in "Collision Layers" or that the mass of the ragdoll rigidbodies is different.

    Best,
    Pärtel
     
    Weendie-Games likes this.
  30. Useless-Media

    Useless-Media

    Joined:
    Apr 19, 2015
    Posts:
    101
    I found it out, it was the Pin Distance Fall Off in the PuppetMaster, the dummy was on 100 and the player on 0
    With both the same amount of 75 we got a nice collision
    DummyCrash.gif


    EDIT: I have the Player Puppet and the Dummy Puppet in the same root game object which ignore the collisions to each other
    MuscleCollisionBroadcarster.png
    I have now a better collision when i spawned the Puppets separate from each other without having the same root gameobject
     
    Last edited: Apr 23, 2018
  31. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    647
    What the best way to sore and reset a puppet?

    So when I spawn a puppet into the scene store all the important data of the puppet, then after the puppet has been killed restore it before re-pooling it ? Or is there a command in PM to do this ? Thanks.
     
  32. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,656
    Hey,
    Please see the "Puppet Respawning" demo and Respawning.cs, has all the pooling/respawning stuff.
     
    Griffo likes this.
  33. unity_kony_X_JrICrmQ

    unity_kony_X_JrICrmQ

    Joined:
    Apr 18, 2018
    Posts:
    2
    yeah, I tried that, it appears to be that it's not working probably. but I believe some quick manual work should fix it.
     
  34. mdotstrange

    mdotstrange

    Joined:
    Sep 23, 2013
    Posts:
    171
    Hello- I'm trying to use "Partial pinning" for my player character by taking note of your demo-

    I'm using Puppetmaster on this character to prevent its head/arms/hands from going through level geometry when the character is bent over from looking at its target using Final Ik's LookAtIk-

    The players ragdoll is working properly to prevent it from going through the level geo-

    The problem I'm having is that now the characters upper body movement is very floppy- I've tried several variations changing the Muscle spring/damper + solver iterations but its still very floppy-

    The only way I've managed to get it less floppy is to turn down the mapping weight but then the characters head/arms etc go through the level geo as it makes the ragdoll less active-

    Do you have any tips for keeping the player from being floppy(lots of secondary motion) when using partial pinning?

    Thank you-
     
  35. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    930
    Today I've mentioned there is two ragdoll on my character. One on the character's biped and other on the biped under puppet master component! Is that normal?
     
  36. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,656
    Which one of Inverctor's assets are you using exactly? Looks like they've changed their entire product listing.

    Hey,

    I have this WIP package that can be used for improved mapping control, requires using BehaviourPuppet too. See the PuppetControllerBasic component added to PuppetMaster in that demo in the package. That's basically the techique I used for setting up character physics in Rick and Morty VR so they could be smoothly pushed and perfectly animated in the same time. I plan on merging that to BehaviourPuppet at some point. Note that the demo character has low pin weight values for the upper body muscles in the PuppetMaster's individual muscle settings.

    Hey,
    No, that should not happen. How exactly did you set up the puppet, do you remember?
    Can You delete the ragdoll components on the biped hierarchy?

    Best,
    Pärtel
     
  37. fritolay1

    fritolay1

    Joined:
    Apr 30, 2018
    Posts:
    2
    I have 3D environment, with 2D characters using images. Rigidbody freeze position Z, freeze rotation X and Y. I have scripts that now will disable animations and turn to ragdoll with hinge joints. I would like a more robust solution. Will this production allow me to animate and have ragdoll with 2D images (And position Z freeze, rotation X and Y freeze), or is it really only for full 3D mesh?
     
  38. witcher101

    witcher101

    Joined:
    Sep 9, 2015
    Posts:
    396
    Hi how many chars i can have on screen. I plan to have 40-50 chars is it possible with puppet.
     
  39. DankP3

    DankP3

    Joined:
    Jul 17, 2017
    Posts:
    4
    First, this is a great asset, a lot of fun too, thanks.

    I have this issue shown in the attached (an IK controlled climbing animation that is robust without ragdoll) where ragdoll extremities become stuck through environmental colliders. They eventually free themselves, but the process is very ugly and so would not be useable in a game.

    My questions are, how can i prevent this using settings that provide a 'realistic' ragdoll? or failing that, what is the best way through code to identify this is about to happen and fix it?

    There are certain animations that promote it (although they don't seem to significantly clip through the walls) and whilst i could take more extreme action, such as disabling ragdoll during 'at risk' periods, I ideally do not want to do this.

    Thanks for help.
     

    Attached Files:

  40. DankP3

    DankP3

    Joined:
    Jul 17, 2017
    Posts:
    4
    Well after a few days of battling this, posting here was somehow cathartic and i realised that I was engaging my IK to soon in the animation and somehow promoting this wall collision event. Having corrected this the errors are much less frequent and considerably more mild.

    However, @Partel-Lang , if there is a good way to sense and prevent these events through code, it would be reassuring to have a failsafe for it. Thanks again.
     
  41. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,656
    It is possible technically if you set the character up with 3D physics objects, there is an example in the package too, under PuppetMaster/_Integration, requires you to download a free 2D asset. This is what it looks like.

    I'd say you could get away with 10-20 simultaneuosly active puppets piled up on a desktop machine. The performance actually is not that much about the number of puppets, but depends on many other things listed here.
    If you decide to get PM, you can run some quick performance tests and if it's not fast enough for you, I can just refund the purchase.

    Hey,
    Yeah, it's a general problem with ragdolls in Unity, it easy to get them stuck. You could try increasing "Solver Iteration Count" in PuppetMaster to make the joints more accurate, design the level to have thicker colliders, reduce "Collision Resistance" for the limbs in BehaviourPuppet to decrease the possibility of pinning forces pulling the limbs into the walls when animation clips into them. I also just added a new tool to the next version of Final IK, called PenetrationAvoidance, uses FullBodyBipedIK to make the character avoid pushing it's hands and feet through the walls. You can import that tool from here.
    I can't think of a way to prevent that from never ever happening though.

    If your puppet is in tree hierarchy, you could store the localPositions of each rigidbody (except for the first) at Start, then check in each LateUpdate the difference of current localPosition.sqrMagnitude compared to the default. If it's more than a threshold, disable colliders for a fixed frame or two for that muscle.
     
  42. DankP3

    DankP3

    Joined:
    Jul 17, 2017
    Posts:
    4
    Great thanks for the help, I was testing monitoring localPosition, but will try the others too. At the moment, I don't have FinalIK, as have done everything else myself.
     
  43. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    930
    This is how you told me to setup.
    Anyway I can delete ragdoll components on the biped hierarchy, should I do this?
     
  44. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,656
    Oh, sorry, I should have mentioned do not ragdoll the original, just the duplicate. That method of setup was designed to be used when you don't want PuppetMaster to change anything in the biped hierarchy.

    Feel free to just delete the ragdoll components on the biped hierarchy.
     
    ksam2 likes this.
  45. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,656
    Hi all,

    I will be off-grid until the 14th due to military exercises. Please leave your questions here, I'll answer them as soon as I get back. Thank you for your patience!

    Cheers,
    Pärtel
     
    Griffo likes this.
  46. PicturesInDark

    PicturesInDark

    Joined:
    Jun 13, 2013
    Posts:
    66
  47. SureSight

    SureSight

    Joined:
    Aug 2, 2013
    Posts:
    49
    Are you thinking of adding support to generate quadruped ragdolls? Hopefully this would use the FinalIK quadruped IK
     
  48. Ayfel

    Ayfel

    Joined:
    Feb 28, 2015
    Posts:
    7
    What would be the best way to simply replace a character model? I have two different models that have same proportions and all but their skinned meshes are slightly different. I just want to replace the model without having to redo the whole setup again (keep same parameters etc). In the case where the rigs are the same I simply replace the skinned mesh but what if they are slightly different? is there a way to keep the ragdoll and all or is it impossible?
     
    Last edited: May 10, 2018
  49. ClayChi

    ClayChi

    Joined:
    Mar 30, 2018
    Posts:
    4
    Hello Partel,

    Just wondering are you going to update both puppetmaster and final IK solvers to new job system in feature? If so how much performance in general it can give and will it solve some unwanted behaviors, like flying off puppets glitches etc especially with props system.
     
  50. Useless-Media

    Useless-Media

    Joined:
    Apr 19, 2015
    Posts:
    101
    Hello

    At the moment im working on the Weapon Aim, i have Final IK and using the Aim IK, it looks like the prop and all other IK elements are really sloppy, when i disable puppet master i get a super accurate aim so i think this depending on the physics interaction which comes with puppet master.

    My plan looks like this: I want rotate the Prop in the Aim Direction to have a accurate Aiming.
    The thing is i can rotate the collider of the prop but the graphics don't rotate with it, when i rotate the graphics and the collider then some update function revert my movement and i think this movement revert comes from Puppet Master.

    Is there a solution which allows me to rotate and change position of a muscle?

    EDIT: I inherited the code of Muscle.MoveToTarget() and its working, thanks
     
    Last edited: May 14, 2018